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.
Represents a function that accepts an int-valued argument and returns a value;
Function might throw a checked exception instance.
- Author:
- Grzegorz Piwowarek
-
Method Summary
Modifier and TypeMethodDescriptionapply(int i) default IntFunction<Optional<R>> lift()static <R> IntFunction<Optional<R>> lifted(ThrowingIntFunction<R, ?> f) Returns a new Function instance which wraps a result of the given function in an Optional, returning an empty Optional in case of a checked exceptionstatic <R> IntFunction<R> sneaky(ThrowingIntFunction<? extends R, ?> function) Returns a new Function instance which rethrows the checked exception using the Sneaky Throws patterndefault IntFunction<R> uncheck()static <R> IntFunction<R> unchecked(ThrowingIntFunction<R, ?> f)
-
Method Details
-
apply
- Throws:
E
-
uncheck
-
unchecked
-
lifted
Returns a new Function instance which wraps a result of the given function in an Optional, returning an empty Optional in case of a checked exception- Type Parameters:
R- type of the result of the function- Parameters:
f- operation throwing checked exception- Returns:
- a Function that returns the result of the given function as an Optional instance.
-
sneaky
Returns a new Function instance which rethrows the checked exception using the Sneaky Throws pattern- Type Parameters:
R- type of the result of the function- Parameters:
function- operation throwing checked exception- Returns:
- Function instance that rethrows the checked exception using the Sneaky Throws pattern
-
lift
-