Package com.complexible.common.base
Class Functional
java.lang.Object
com.complexible.common.base.Functional
Functional utilities
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A,B, C> Function <A, C> Function composition as a static method which is more convenient than casting a lambda and callingFunction.compose(Function).mapEntryBiConsumer(BiConsumer<K, V> consumer) Transform a BiConsumer to acceptMap.EntrymapEntryBiFunction(BiFunction<K, V, R> mapper) Transform a BiFunction to operate over aMap.Entrystatic BooleanSupplierBooleanSupplier negation as a static method.static <T> Predicate<T> Predicate negation as a static method which is more convenient than casting a lambda and callingPredicate.negate().static <T> BinaryOperator<T> A binary operator to be used with non-parallelStream.reduce(Object, BiFunction, BinaryOperator)calls when a combiner is not needed.static <T,R> Function <T, R> wrapPartial(Function<T, R> partialFunction, Function<T, R> ifNullFunction) Wrap a partial function (a function that can return null) with another function that replaces nulls.static <T> UnaryOperator<T> wrapPartialWithIdentity(UnaryOperator<T> partialFunction) Transform partial function to a total function by falling back to identity when the input is not mapped.
-
Constructor Details
-
Functional
public Functional()
-
-
Method Details
-
mapEntryBiFunction
Transform a BiFunction to operate over aMap.Entry -
mapEntryBiConsumer
Transform a BiConsumer to acceptMap.Entry -
wrapPartialWithIdentity
Transform partial function to a total function by falling back to identity when the input is not mapped. -
wrapPartial
public static <T,R> Function<T,R> wrapPartial(Function<T, R> partialFunction, Function<T, R> ifNullFunction) Wrap a partial function (a function that can return null) with another function that replaces nulls. -
compose
public static <A,B, Function<A,C> C> compose(Function<? super B, C> g, Function<? super A, ? extends B> f) Function composition as a static method which is more convenient than casting a lambda and callingFunction.compose(Function). -
negate
Predicate negation as a static method which is more convenient than casting a lambda and callingPredicate.negate(). -
negate
BooleanSupplier negation as a static method. -
throwingCombiner
A binary operator to be used with non-parallelStream.reduce(Object, BiFunction, BinaryOperator)calls when a combiner is not needed.
-