| 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,Throwable> throwableFunction)
Creates a safe
Function, |
static <T,R> Function<T,R> |
safe(ThrowableFunction<? super T,? extends R,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 f1R - the type of the result of composed function f1f1 - the function for transform Function f2 result to the type Rf2 - the Function which is called firstNullPointerException - 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 f2V - the type of the result of composed function f2f1 - the Function which is called firstf2 - the function for transform Function f1 result to the type VNullPointerException - 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,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 thrownNullPointerException - 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,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 thrownresultIfFailedNullPointerException - if throwableFunction is nullsafe(com.annimon.stream.function.ThrowableFunction)Copyright © 2018. All rights reserved.