public class Functionals
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Functionals.ConstantFunction<I,O>
like guava equivalent but parametrises the input generic type, and allows tostring to be customised
|
Constructor and Description |
---|
Functionals() |
Modifier and Type | Method and Description |
---|---|
static <T,U> java.util.concurrent.Callable<U> |
callable(com.google.common.base.Function<T,U> f,
T x) |
static <T> java.util.concurrent.Callable<T> |
callable(com.google.common.base.Supplier<T> supplier) |
static <A,B,C,D,E> |
chain(com.google.common.base.Function<A,? extends B> f1,
com.google.common.base.Function<B,? extends C> f2,
com.google.common.base.Function<C,? extends D> f3,
com.google.common.base.Function<D,E> f4)
applies f1 to the input, then f2 to that result, then f3 to that result, then f4 to that result
|
static <A,B,C,D> com.google.common.base.Function<A,D> |
chain(com.google.common.base.Function<A,? extends B> f1,
com.google.common.base.Function<B,? extends C> f2,
com.google.common.base.Function<C,D> f3)
applies f1 to the input, then f2 to that result, then f3 to that result
|
static <A,B,C> com.google.common.base.Function<A,C> |
chain(com.google.common.base.Function<A,? extends B> f1,
com.google.common.base.Function<B,C> f2)
applies f1 to the input, then the result of that is passed to f2 (note opposite semantics to
Functions.compose(Function, Function) |
static <I> com.google.common.base.Function<I,java.lang.Void> |
function(java.lang.Runnable runnable) |
static <I,O> com.google.common.base.Function<I,O> |
function(com.google.common.base.Supplier<O> supplier)
like guava
Functions.forSupplier(Supplier) but parametrises the input generic type |
static <I> IfFunctions.IfFunctionBuilderApplyingFirst<I> |
ifEquals(I test) |
static <I> IfFunctions.IfFunctionBuilderApplyingFirst<I> |
ifNotEquals(I test) |
static <I> IfFunctions.IfFunctionBuilderApplyingFirst<I> |
ifPredicate(com.google.common.base.Predicate<I> test) |
static <T> com.google.common.base.Predicate<T> |
predicate(com.google.common.base.Function<T,java.lang.Boolean> f) |
static java.lang.Runnable |
runnable(com.google.common.base.Supplier<?> supplier) |
public static <A,B,C> com.google.common.base.Function<A,C> chain(com.google.common.base.Function<A,? extends B> f1, com.google.common.base.Function<B,C> f2)
Functions.compose(Function, Function)
public static <A,B,C,D> com.google.common.base.Function<A,D> chain(com.google.common.base.Function<A,? extends B> f1, com.google.common.base.Function<B,? extends C> f2, com.google.common.base.Function<C,D> f3)
public static <A,B,C,D,E> com.google.common.base.Function<A,E> chain(com.google.common.base.Function<A,? extends B> f1, com.google.common.base.Function<B,? extends C> f2, com.google.common.base.Function<C,? extends D> f3, com.google.common.base.Function<D,E> f4)
public static <I> IfFunctions.IfFunctionBuilderApplyingFirst<I> ifEquals(I test)
IfFunctions
public static <I> IfFunctions.IfFunctionBuilderApplyingFirst<I> ifNotEquals(I test)
IfFunctions
public static <I> IfFunctions.IfFunctionBuilderApplyingFirst<I> ifPredicate(com.google.common.base.Predicate<I> test)
IfFunctions
public static <I,O> com.google.common.base.Function<I,O> function(com.google.common.base.Supplier<O> supplier)
Functions.forSupplier(Supplier)
but parametrises the input generic typepublic static <I> com.google.common.base.Function<I,java.lang.Void> function(java.lang.Runnable runnable)
public static java.lang.Runnable runnable(com.google.common.base.Supplier<?> supplier)
public static <T> java.util.concurrent.Callable<T> callable(com.google.common.base.Supplier<T> supplier)
public static <T,U> java.util.concurrent.Callable<U> callable(com.google.common.base.Function<T,U> f, T x)
public static <T> com.google.common.base.Predicate<T> predicate(com.google.common.base.Function<T,java.lang.Boolean> f)