Class BiFunctionSupport
java.lang.Object
net.shibboleth.utilities.java.support.logic.BiFunctionSupport
public final class BiFunctionSupport extends Object
Helper class for constructing
BiFunction
s in a Spring-friendly manner.- Since:
- 8.1.0
-
Constructor Summary
Constructors Modifier Constructor Description private
BiFunctionSupport()
Constructor. -
Method Summary
Modifier and Type Method Description static <A, B, C, D> BiFunction<A,B,D>
compose(Function<? super C,? extends D> g, BiFunction<A,B,? extends C> f)
A static version ofBiFunction.andThen(Function)
.static <T, U, V> BiFunction<T,U,V>
constant(V target)
Creates aBiFunction
that returns a constant value.static <T, U> BiFunction<T,U,Boolean>
forBiPredicate(BiPredicate<? super T,? super U> predicate)
Creates aBiFunction
that returns the same boolean output as the givenBiPredicate
for all inputs.
-
Constructor Details
-
BiFunctionSupport
private BiFunctionSupport()Constructor.
-
-
Method Details
-
constant
@Nonnull public static <T, U, V> BiFunction<T,U,V> constant(@Nonnull @ParameterName(name="target") V target)Creates aBiFunction
that returns a constant value.- Type Parameters:
T
- type of object the function needs to act onU
- type of object the function needs to act onV
- type of object being returned- Parameters:
target
- the value to return from the function- Returns:
- the constructed function
-
compose
@Nonnull public static <A, B, C, D> BiFunction<A,B,D> compose(@Nonnull @ParameterName(name="g") Function<? super C,? extends D> g, @Nonnull @ParameterName(name="f") BiFunction<A,B,? extends C> f)A static version ofBiFunction.andThen(Function)
.- Type Parameters:
A
- input to composedBiFunction
B
- input to composedBiFunction
C
- output of inputBiFunction
D
- output of composedBiFunction
- Parameters:
g
- the second function to applyf
- the firstBiFunction
to apply- Returns:
- the composition of
f
andg
- See Also:
- function composition
-
forBiPredicate
@Nonnull public static <T, U> BiFunction<T,U,Boolean> forBiPredicate(@Nonnull @ParameterName(name="predicate") BiPredicate<? super T,? super U> predicate)Creates aBiFunction
that returns the same boolean output as the givenBiPredicate
for all inputs.- Type Parameters:
T
- input typeU
- input type- Parameters:
predicate
- inputBiPredicate
- Returns:
- a corresponding
BiFunction
-