Interface CheckedFunction<T,R,E extends Throwable>
- Type Parameters:
T
- function argument typeR
- function result typeE
- exception type
- All Superinterfaces:
Function<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.
@FunctionalInterface
public interface CheckedFunction<T,R,E extends Throwable>
extends Function<T,R>
Extension of
Function
that allows to throw checked exception.-
Method Summary
Modifier and TypeMethodDescriptiondefault R
OverridesFunction.apply(Object)
method to allow calling functions that throw checked exceptions.applyAndThrow
(T t) Applies function to the given argument.
-
Method Details
-
apply
OverridesFunction.apply(Object)
method to allow calling functions that throw checked exceptions. Is useful when used in methods that acceptFunction
. For example:Map.computeIfAbsent(Object, Function)
. -
applyAndThrow
Applies function to the given argument.- Parameters:
t
- the function argument- Returns:
- the function result
- Throws:
E
- exception in case of errors
-