Package net.shibboleth.shared.logic
Class BiFunctionSupport
java.lang.Object
net.shibboleth.shared.logic.BiFunctionSupport
Helper class for constructing
BiFunctions in a Spring-friendly manner.- Since:
- 8.1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <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 aBiFunctionthat returns a constant value.static <T,U> BiFunction<T, U, Boolean> forBiPredicate(BiPredicate<? super T, ? super U> predicate) Creates aBiFunctionthat returns the same boolean output as the givenBiPredicatefor all inputs.static <A,B, C> BiFunction<A, B, C> forFunctionOfFirstArg(Function<? super A, ? extends C> function) Adapts aFunctioninto a {BiFunction} that ignores the second argument.static <A,B, C> BiFunction<A, B, C> forFunctionOfSecondArg(Function<? super B, ? extends C> function) Adapts aFunctioninto a {BiFunction} that ignores the first argument.
-
Constructor Details
-
BiFunctionSupport
private BiFunctionSupport()Constructor.
-
-
Method Details
-
constant
@Nonnull public static <T,U, BiFunction<T,V> U, constantV> (@Nonnull @ParameterName(name="target") V target) Creates aBiFunctionthat 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, BiFunction<A,C, D> B, composeD> (@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 composedBiFunctionB- input to composedBiFunctionC- output of inputBiFunctionD- output of composedBiFunction- Parameters:
g- the second function to applyf- the firstBiFunctionto apply- Returns:
- the composition of
fandg - See Also:
-
forBiPredicate
@Nonnull public static <T,U> BiFunction<T,U, forBiPredicateBoolean> (@Nonnull @ParameterName(name="predicate") BiPredicate<? super T, ? super U> predicate) Creates aBiFunctionthat returns the same boolean output as the givenBiPredicatefor all inputs.- Type Parameters:
T- input typeU- input type- Parameters:
predicate- inputBiPredicate- Returns:
- a corresponding
BiFunction
-
forFunctionOfFirstArg
@Nonnull public static <A,B, BiFunction<A,C> B, forFunctionOfFirstArgC> (@Nonnull @ParameterName(name="function") Function<? super A, ? extends C> function) Adapts aFunctioninto a {BiFunction} that ignores the second argument.- Type Parameters:
A- input type of functionB- ignored argument typeC- return type- Parameters:
function- the function to apply- Returns:
- the adapted object
- Since:
- 8.3.0
-
forFunctionOfSecondArg
@Nonnull public static <A,B, BiFunction<A,C> B, forFunctionOfSecondArgC> (@Nonnull @ParameterName(name="function") Function<? super B, ? extends C> function) Adapts aFunctioninto a {BiFunction} that ignores the first argument.- Type Parameters:
A- ignored argument typeB- input type of functionC- return type- Parameters:
function- the function to apply- Returns:
- the adapted object
- Since:
- 8.3.0
-