All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.tonivade.purefun.Consumer2 Maven / Gradle / Ivy

/*
 * Copyright (c) 2018-2019, Antonio Gabriel Muñoz Conejo 
 * Distributed under the terms of the MIT License
 */
package com.github.tonivade.purefun;

import static com.github.tonivade.purefun.Unit.unit;

@FunctionalInterface
public interface Consumer2 {

  void accept(A value1, B value2);

  default Consumer2 andThen(Consumer2 after) {
    return (value1, value2) -> { accept(value1, value2); after.accept(value1, value2); };
  }

  default Function2 asFunction() {
    return (value1, value2) -> { accept(value1, value2); return unit(); };
  }

  static  Consumer2 of(Consumer2 reference) {
    return reference;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy