Interface BiFunction<T,​U,​R>

Type Parameters:
T - the type of the first argument to the function
U - the type of the second argument to the function
R - the type of the result of the function
All Superinterfaces:
BiFunction<T,​U,​R>
All Known Subinterfaces:
BinaryOperator<T>, BiPredicate<T,​U>, DoubleBinaryOperator, IntBinaryOperator, LongBinaryOperator, ToDoubleBiFunction<T,​U>, ToIntBiFunction<T,​U>, ToLongBiFunction<T,​U>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface
public interface BiFunction<T,​U,​R>
extends BiFunction<T,​U,​R>
Represents a function that accepts two arguments and produces a result. This is the two-arity specialization of Function.

This is a functional interface whose functional method is apply(Object, Object).

Since:
1.8
See Also:
Function
  • Method Details

    • apply

      R apply​(T t, U u)
      Applies this function to the given arguments.
      Specified by:
      apply in interface BiFunction<T,​U,​R>
      Parameters:
      t - the first function argument
      u - the second function argument
      Returns:
      the function result
    • applyPartial

      default Supplier<R> applyPartial​(T t, U u)
      Performs a partial application, resulting in a function that calls this with its argument and the argument given here.
      Parameters:
      t - the first function argument
      u - the second function argument
      Returns:
      the function result
    • applyPartialL

      default Function<U,​R> applyPartialL​(T t)
      Performs a partial application, resulting in a function that calls this with its argument and the argument given here.
      Parameters:
      t - the function argument
      Returns:
      the function result
    • applyPartialR

      default Function<T,​R> applyPartialR​(U u)
      Performs a partial application, resulting in a function that calls this with its argument and the argument given here.
      Parameters:
      u - the function argument
      Returns:
      the function result
    • consume

      default BiConsumer<T,​U> consume​(Consumer<R> consumer)
      Consume a function.
      Parameters:
      consumer - The consumer to use in consuming.
      Returns:
      A Consumer which passes it's argument to this function and then passes the result into the given consumer.
    • predicate

      default BiPredicate<T,​U> predicate​(Predicate<? super R> functor)
      Lift a function.
      Parameters:
      functor - The function to use in lifting.
      Returns:
      A function that passes the result of fn through a functor to produce a lifted function.
    • map

      default <S> BiFunction<T,​U,​S> map​(Function<? super R,​? extends S> functor)
      Lift a function.
      Type Parameters:
      S - The return type.
      Parameters:
      functor - The function to use in lifting.
      Returns:
      A function that passes the result of fn through a functor to produce a lifted function.
    • mapToDouble

      default ToDoubleBiFunction<T,​U> mapToDouble​(ToDoubleFunction<? super R> functor)
      Lift a function.
      Parameters:
      functor - The function to use in lifting.
      Returns:
      A function that passes the result of fn through a functor to produce a lifted function.
    • mapToInt

      default ToIntBiFunction<T,​U> mapToInt​(ToIntFunction<? super R> functor)
      Lift a function.
      Parameters:
      functor - The function to use in lifting.
      Returns:
      A function that passes the result of fn through a functor to produce a lifted function.
    • mapToLong

      default ToLongBiFunction<T,​U> mapToLong​(ToLongFunction<? super R> functor)
      Lift a function.
      Parameters:
      functor - The function to use in lifting.
      Returns:
      A function that passes the result of fn through a functor to produce a lifted function.