Modifier and Type | Method and Description |
---|---|
static <T,R,V> Function<T,V> |
andThen(Function<? super T,? extends R> f1,
Function<? super R,? extends V> f2)
Composes
Function calls. |
static <V,T,R> Function<V,R> |
compose(Function<? super T,? extends R> f1,
Function<? super V,? extends T> f2)
Composes
Function calls. |
static <T,R> Function<T,R> |
safe(ThrowableFunction<? super T,? extends R,java.lang.Throwable> throwableFunction)
Creates a safe
Function , |
static <T,R> Function<T,R> |
safe(ThrowableFunction<? super T,? extends R,java.lang.Throwable> throwableFunction,
R resultIfFailed)
Creates a safe
Function , |
public static <V,T,R> Function<V,R> compose(Function<? super T,? extends R> f1, Function<? super V,? extends T> f2)
Function
calls.
f1.apply(f2.apply(v))
V
- the type of the input argument of first functionT
- the type of the result of f2
and input argument of f1
R
- the type of the result of composed function f1
f1
- the function for transform Function f2
result to the type R
f2
- the Function
which is called firstjava.lang.NullPointerException
- if f1
or f2
or result of Function f1
is nullandThen(com.annimon.stream.function.Function, com.annimon.stream.function.Function)
public static <T,R,V> Function<T,V> andThen(Function<? super T,? extends R> f1, Function<? super R,? extends V> f2)
Function
calls.
f2.apply(f1.apply(t))
T
- the type of the input argument of first functionR
- the type of the result of f1
and input argument of f2
V
- the type of the result of composed function f2
f1
- the Function
which is called firstf2
- the function for transform Function f1
result to the type V
java.lang.NullPointerException
- if f1
or f2
or result of Function f1
is nullcompose(com.annimon.stream.function.Function, com.annimon.stream.function.Function)
public static <T,R> Function<T,R> safe(ThrowableFunction<? super T,? extends R,java.lang.Throwable> throwableFunction)
Function
,T
- the type of the input of the functionR
- the type of the result of the functionthrowableFunction
- the function that may throw an exceptionnull
if exception was thrownjava.lang.NullPointerException
- if throwableFunction
is nullsafe(com.annimon.stream.function.ThrowableFunction, java.lang.Object)
public static <T,R> Function<T,R> safe(ThrowableFunction<? super T,? extends R,java.lang.Throwable> throwableFunction, R resultIfFailed)
Function
,T
- the type of the input of the functionR
- the type of the result of the functionthrowableFunction
- the function that may throw an exceptionresultIfFailed
- the result which returned if exception was thrownresultIfFailed
java.lang.NullPointerException
- if throwableFunction
is nullsafe(com.annimon.stream.function.ThrowableFunction)