Package com.pivovarit.function
Interface ThrowingIntFunction<R,E extends Exception>
- Type Parameters:
R
- the type of the result of the functionE
- the type of the thrown checked exception
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface mirroring
IntFunction<R>
for primitive ints from the java.util.function package.
This allows wrapping a exceptions in a runtime exception: WrappedException
As this adheres to the IntFunction
interface, compose and andThen (as you might be familiar with from
Function
are not available.
-
Method Summary
Modifier and TypeMethodDescriptionapply
(int i) default IntFunction
<Optional<R>> lift()
static <R> IntFunction
<Optional<R>> lifted
(ThrowingIntFunction<R, ?> f) static <R> IntFunction
<R> sneaky
(ThrowingIntFunction<? extends R, ?> function) default IntFunction
<R> uncheck()
static <R> IntFunction
<R> unchecked
(ThrowingIntFunction<R, ?> f)
-
Method Details
-
apply
- Throws:
E
-
uncheck
-
unchecked
-
lifted
- Returns:
- a Function that returns the result of the given function as an Optional instance. In case of a failure, empty Optional is returned
-
sneaky
-
lift
-