Interface ThrowingFunction<T,R>
- Type Parameters:
T- the type of the input to the functionR- the type of the result of the function
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Equivalent of
Function whose apply(Object) method may throw a checked
Exception.
This interface helps to avoid wrapping checked exceptions in runtime exceptions when using functional APIs.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <V> ThrowingFunction<T, V> andThen(@NonNull ThrowingFunction<? super R, ? extends V> after) Returns a composed function that first applies this function to its input, and then applies theafterfunction to the result.Applies this function to the given argument.default <V> ThrowingFunction<V, R> compose(@NonNull ThrowingFunction<? super V, ? extends T> before) Returns a composed function that first applies thebeforefunction to its input, and then applies this function to the result.
-
Method Details
-
apply
-
compose
default <V> ThrowingFunction<V,R> compose(@NonNull @NonNull ThrowingFunction<? super V, ? extends T> before) Returns a composed function that first applies thebeforefunction to its input, and then applies this function to the result.- Type Parameters:
V- the type of input to thebeforefunction, and to the composed function- Parameters:
before- the function to apply before this function- Returns:
- a composed function that first applies the
beforefunction and then this function
-
andThen
default <V> ThrowingFunction<T,V> andThen(@NonNull @NonNull ThrowingFunction<? super R, ? extends V> after) Returns a composed function that first applies this function to its input, and then applies theafterfunction to the result.- Type Parameters:
V- the type of output of theafterfunction, and of the composed function- Parameters:
after- the function to apply after this function- Returns:
- a composed function that first applies this function and then the
afterfunction
-