Package com.pivovarit.function
Interface ThrowingFunction<T,R,E extends java.lang.Exception>
-
- Type Parameters:
T
- the type of the input to the functionR
- the type of the result of the functionE
- the type of the thrown checked exception
- All Known Subinterfaces:
ThrowingUnaryOperator<T,E>
- 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 ThrowingFunction<T,R,E extends java.lang.Exception>
Represents a function that accepts one argument and returns a value; Function might throw a checked exception instance.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <V> ThrowingFunction<T,V,E>
andThen(ThrowingFunction<? super R,? extends V,? extends E> after)
R
apply(T arg)
default <V> ThrowingFunction<V,R,E>
compose(ThrowingFunction<? super V,? extends T,? extends E> before)
default java.util.function.Function<T,java.util.Optional<R>>
lift()
static <T,R>
java.util.function.Function<T,java.util.Optional<R>>lifted(ThrowingFunction<T,R,?> f)
static <T1,R>
java.util.function.Function<T1,R>sneaky(ThrowingFunction<? super T1,? extends R,?> function)
default java.util.function.Function<T,R>
uncheck()
static <T,R>
java.util.function.Function<T,R>unchecked(ThrowingFunction<T,R,?> f)
-
-
-
Method Detail
-
lifted
static <T,R> java.util.function.Function<T,java.util.Optional<R>> lifted(ThrowingFunction<T,R,?> f)
- Returns:
- a Function that returns the result of the given function as an Optional instance. In case of a failure, empty Optional is returned
-
unchecked
static <T,R> java.util.function.Function<T,R> unchecked(ThrowingFunction<T,R,?> f)
-
sneaky
static <T1,R> java.util.function.Function<T1,R> sneaky(ThrowingFunction<? super T1,? extends R,?> function)
-
compose
default <V> ThrowingFunction<V,R,E> compose(ThrowingFunction<? super V,? extends T,? extends E> before)
-
andThen
default <V> ThrowingFunction<T,V,E> andThen(ThrowingFunction<? super R,? extends V,? extends E> after)
-
-