Interface CheckedTripleFunction<T1,T2,T3,R>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Variant of
– the first function argument type
– the second function argument type
– the third function argument type
– the function result type
TripleFunction that behaves like TripleFunction, but which allows checked Exception's to be thrown
from its apply(Object, Object, Object) method-
Method Summary
Modifier and TypeMethodDescriptionThis method performs the operation that may fail with a CheckedExceptionstatic <T1,T2, T3, R>
TripleFunction<T1,T2, T3, R> safe(CheckedTripleFunction<T1, T2, T3, R> functionThatCanFailWithACheckedException) Wraps aCheckedTripleFunction(basically a lambda with three arguments that returns a result and which throws a CheckedException) by returning a newTripleFunctioninstance
The returnedTripleFunction.apply(Object, Object, Object)method delegates directly to theapply(Object, Object, Object)and catches any thrown checkedException's and rethrows them as aCheckedExceptionRethrownException
Unless you provide a context-message (usingsafe(String, CheckedTripleFunction)then any caught checkedException's message also becomes theCheckedExceptionRethrownException's message.
AnyRuntimeException's thrown aren't caught and the calling code will receive the originalRuntimeExceptionthrown.
Usage example:
Let's say we have a method calledsomeOperationthat cannot change, but which accepts aTripleFunctionwith the purpose of the calling theTripleFunction.apply(Object, Object, Object).static <T1,T2, T3, R>
TripleFunction<T1,T2, T3, R> safe(String contextMessage, CheckedTripleFunction<T1, T2, T3, R> functionThatCanFailWithACheckedException) Wraps aCheckedTripleFunction(basically a lambda with three arguments that returns a result and which throws a CheckedException) by returning a newTripleFunctioninstance
The returnedTripleFunction.apply(Object, Object, Object)method delegates directly to theapply(Object, Object, Object)and catches any thrown checkedException's and rethrows them as aCheckedExceptionRethrownException
AnyRuntimeException's thrown aren't caught and the calling code will receive the originalRuntimeExceptionthrown.
Usage example:
Let's say we have a method calledsomeOperationthat cannot change, but which accepts aTripleFunctionwith the purpose of the calling theTripleFunction.apply(Object, Object, Object).
-
Method Details
-
apply
This method performs the operation that may fail with a CheckedException- Parameters:
arg1- the first function argumentarg2- the second function argumentarg3- the third function argument- Returns:
- the result of performing the function
- Throws:
Exception- this method can throw both checkedException's as well asRuntimeException's