Package io.activej.common.function
Interface FunctionEx<T,R>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a
Function capable of throwing exceptions-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> FunctionEx<T,T> identity()A function that returns passed value as is.static <T,R> FunctionEx<T, R> Creates aFunctionExout ofFunctionstatic <T,R> Function<T, R> uncheckedOf(FunctionEx<T, R> checkedFn) Creates aFunctionout ofFunctionEx
-
Method Details
-
apply
- Throws:
Exception
-
of
Creates aFunctionExout ofFunctionIf given function throws
UncheckedException, its cause will be propagated- Parameters:
fn- originalFunction- Returns:
- a function capable of throwing exceptions
-
uncheckedOf
Creates aFunctionout ofFunctionExIf given function throws a checked exception, it will be wrapped into
UncheckedExceptionand rethrownUnchecked exceptions will be handled by thread's
FatalErrorHandler- Parameters:
checkedFn- originalFunctionEx- Returns:
- a function
-
identity
A function that returns passed value as is. Does not throw any exception
-