Interface FailableFunction<T,R,E extends Throwable>
- Type Parameters:
T
- Input type 1.R
- Return type.E
- Thrown exception.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A functional interface like
Function
that declares a Throwable
.- Since:
- 3.11
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault <V> FailableFunction<T,
V, E> andThen
(FailableFunction<? super R, ? extends V, E> after) Returns a composedFailableFunction
likeFunction.andThen(Function)
.Applies this function.default <V> FailableFunction<V,
R, E> compose
(FailableFunction<? super V, ? extends T, E> before) Returns a composedFailableFunction
likeFunction.compose(Function)
.static <T,
E extends Throwable>
FailableFunction<T,T, E> identity()
Returns a function that always returns its input argument.static <T,
R, E extends Throwable>
FailableFunction<T,R, E> nop()
Returns The NOP singleton.
-
Field Details
-
NOP
NOP singleton
-
-
Method Details
-
identity
Returns a function that always returns its input argument.- Type Parameters:
T
- the type of the input and output objects to the functionE
- Thrown exception.- Returns:
- a function that always returns its input argument
-
nop
Returns The NOP singleton.- Type Parameters:
T
- Consumed type 1.R
- Return type.E
- Thrown exception.- Returns:
- The NOP singleton.
-
andThen
Returns a composedFailableFunction
likeFunction.andThen(Function)
.- Type Parameters:
V
- the output type of theafter
function, and of the composed function.- Parameters:
after
- the operation to perform after this one.- Returns:
- a composed
FailableFunction
likeFunction.andThen(Function)
. - Throws:
NullPointerException
- whenafter
is null.
-
apply
Applies this function.- Parameters:
input
- the input for the function- Returns:
- the result of the function
- Throws:
E
- Thrown when the function fails.
-
compose
Returns a composedFailableFunction
likeFunction.compose(Function)
.- Type Parameters:
V
- the input type to thebefore
function, and to the composed function.- Parameters:
before
- the operator to apply before this one.- Returns:
- a a composed
FailableFunction
likeFunction.compose(Function)
. - Throws:
NullPointerException
- if before is null.- See Also:
-