Package org.pipecraft.infra.concurrent
Interface FailableFunction<T,R,E extends Exception>
-
- Type Parameters:
T- The type of the inputR- The type of the outputE- The exception type
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface FailableFunction<T,R,E extends Exception>
A function that may fail with a checked exception during the execution of the apply(..) method.- Author:
- Eyal Schneider
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <V> FailableFunction<T,V,E>andThen(FailableFunction<? super R,? extends V,E> after)Similar to Function.andThen(..), but works withFailableFunctionRapply(T v)Applies the functiondefault <V> FailableFunction<V,R,E>compose(FailableFunction<? super V,? extends T,E> before)Similar to Function.compose(..), but works withFailableFunctionstatic <T,E extends Exception>
FailableFunction<T,T,E>identity()Similar to Function.identity(), but returns aFailableFunction
-
-
-
Method Detail
-
compose
default <V> FailableFunction<V,R,E> compose(FailableFunction<? super V,? extends T,E> before)
Similar to Function.compose(..), but works withFailableFunction- Type Parameters:
V- The input type of the supplied function to be applied first- Parameters:
before- the function to apply before this function is applied- Returns:
- a composed
FailableFunctionthat first applies the before function and then applies this function
-
andThen
default <V> FailableFunction<T,V,E> andThen(FailableFunction<? super R,? extends V,E> after)
Similar to Function.andThen(..), but works withFailableFunction- Type Parameters:
V- The output type of the supplied function- Parameters:
after- theFailableFunctionto apply after this function is applied- Returns:
- a composed function that first applies this function and then applies the after function
-
identity
static <T,E extends Exception> FailableFunction<T,T,E> identity()
Similar to Function.identity(), but returns aFailableFunction- Type Parameters:
T- The input/output typeE- The error type- Returns:
- a function that always returns its input argument.
-
-