Interface BiFunction<T,U,R>
- Type Parameters:
T- the former parameter typeU- the latter parameter typeR- the result type
- All Superinterfaces:
BiFunction<T,U, R>
- All Known Subinterfaces:
BinaryOperator<T>
- All Known Implementing Classes:
HotRodSessionMetaDataFactory
An enhanced binary function.
- Author:
- Paul Ferraro
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BiFunction<?, ?, ?> An identity function using the former parameterstatic final BiFunction<?, ?, ?> An identity function using the latter parameterstatic final BiFunction<?, ?, ?> A function that always returns null. -
Method Summary
Modifier and TypeMethodDescriptiondefault <V> BiFunction<T, U, V> static <T,U, R> BiFunction <T, U, R> applyFormer(Function<T, R> function) Returns a function that applies the former parameter to the specified function.static <T,U, R> BiFunction <T, U, R> applyLatter(Function<U, R> function) Returns a function that applies the latter parameter to the specified function.default <V1,V2> BiFunction <V1, V2, R> Composes a function that applies the specified functions to each parameter as inputs to this function.composeUnary(Function<? super V, ? extends T> before1, Function<? super V, ? extends U> before2) Composes a unary function that applies the specified functions to its parameter as inputs to this function.static <T,U, R> BiFunction <T, U, R> empty()Returns a function that always returns the specified value, ignoring its parameters.static <T extends R, U, R>
BiFunction<T, U, R> former()Returns a function that returns its first parameter.static <T, U extends R, R>
BiFunction<T, U, R> latter()Returns a function that returns its second parameter.static <T,U, R> BiFunction <T, U, R> of(BiConsumer<T, U> consumer, Supplier<R> supplier) Returns a function that accepts its parameters via the specified consumer and returns the value returned by the specified supplier.static <T,U, R> BiFunction <T, U, R> of(R result) Returns a function that always returns the specified value, ignoring its parameter.default BiFunction<T, U, R> Returns a function that applies this function if its parameters matches the specified predicate, or returns the value provided by the specified supplier otherwise.default BiFunction<U, T, R> reverse()Returns a function that processes this function with reversed parameter order.default BiFunction<T, U, R> withDefault(Predicate<T> predicate1, Supplier<T> defaultValue1, Predicate<U> predicate2, Supplier<U> defaultValue2) Returns a function that applies this function to the values returned by the specified providers if its parameters do not match the specified predicates.Methods inherited from interface BiFunction
apply
-
Field Details
-
FORMER_IDENTITY
An identity function using the former parameter -
LATTER_IDENTITY
An identity function using the latter parameter -
NULL
A function that always returns null.
-
-
Method Details
-
compose
default <V1,V2> BiFunction<V1,V2, composeR> (Function<? super V1, ? extends T> before1, Function<? super V2, ? extends U> before2) Composes a function that applies the specified functions to each parameter as inputs to this function.- Type Parameters:
V1- the first parameter function typeV2- the second parameter function type- Parameters:
before1- the function applied to the first parameterbefore2- the function applied to the second parameter- Returns:
- a composed function that applies the specified functions to each parameter as inputs to this function.
-
composeUnary
default <V> Function<V,R> composeUnary(Function<? super V, ? extends T> before1, Function<? super V, ? extends U> before2) Composes a unary function that applies the specified functions to its parameter as inputs to this function.- Type Parameters:
V- the parameter function type- Parameters:
before1- the function applied to the first parameterbefore2- the function applied to the second parameter- Returns:
- a composed function that applies the specified functions to its parameter as inputs to this function.
-
andThen
- Specified by:
andThenin interfaceBiFunction<T,U, R>
-
reverse
Returns a function that processes this function with reversed parameter order.- Returns:
- a function that processes this function with reversed parameter order.
-
withDefault
default BiFunction<T,U, withDefaultR> (Predicate<T> predicate1, Supplier<T> defaultValue1, Predicate<U> predicate2, Supplier<U> defaultValue2) Returns a function that applies this function to the values returned by the specified providers if its parameters do not match the specified predicates.- Parameters:
predicate1- a predicate used to determine the first parameter of this functiondefaultValue1- a provider of the default value of the first parameterpredicate2- a predicate used to determine the second parameter of this functiondefaultValue2- a provider of the default value of the second parameter- Returns:
- a function that applies this function to the value returned by the specified provider if its value does not match the specified predicate.
-
orDefault
Returns a function that applies this function if its parameters matches the specified predicate, or returns the value provided by the specified supplier otherwise.- Parameters:
predicate- a predicate used to determine the parameter of this functiondefaultResult- a provider of the default parameter value- Returns:
- a function that applies this function if its parameter matches the specified predicate, or returns the value provided by the specified supplier otherwise.
-
former
Returns a function that returns its first parameter.- Type Parameters:
T- the first parameter typeU- the second parameter typeR- the function return type- Returns:
- a function that returns its first parameter.
-
latter
Returns a function that returns its second parameter.- Type Parameters:
T- the first parameter typeU- the second parameter typeR- the function return type- Returns:
- a function that returns its first parameter.
-
empty
Returns a function that always returns the specified value, ignoring its parameters.- Type Parameters:
T- the first parameter typeU- the second parameter typeR- the function return type- Returns:
- a function that always returns the specified value, ignoring its parameters.
-
of
Returns a function that always returns the specified value, ignoring its parameter.- Type Parameters:
T- the first parameter typeU- the second parameter typeR- the function return type- Parameters:
result- the function result- Returns:
- a function that always returns the specified value, ignoring its parameter.
-
of
Returns a function that accepts its parameters via the specified consumer and returns the value returned by the specified supplier.- Type Parameters:
T- the former parameter typeU- the latter parameter typeR- the function return type- Parameters:
consumer- the consumer of the function parametersupplier- the supplier of the function result- Returns:
- a function that accepts its parameters via the specified consumer and returns the value returned by the specified supplier.
-
applyFormer
Returns a function that applies the former parameter to the specified function.- Type Parameters:
T- the former parameter typeU- the latter parameter typeR- the function return type- Parameters:
function- the function applied to the former parameter- Returns:
- a function that applies the former parameter to the specified function.
-
applyLatter
Returns a function that applies the latter parameter to the specified function.- Type Parameters:
T- the former parameter typeU- the latter parameter typeR- the function return type- Parameters:
function- the function applied to the latter parameter- Returns:
- a function that applies the latter parameter to the specified function.
-