Uses of Interface
dk.cloudcreate.essentials.shared.functional.CheckedBiFunction
Packages that use CheckedBiFunction
-
Uses of CheckedBiFunction in dk.cloudcreate.essentials.shared.functional
Methods in dk.cloudcreate.essentials.shared.functional with parameters of type CheckedBiFunctionModifier and TypeMethodDescriptionstatic <T1,T2, R> BiFunction<T1, T2, R> CheckedBiFunction.safe(CheckedBiFunction<T1, T2, R> functionThatCanFailWithACheckedException) Wraps aCheckedBiFunction(basically a lambda with two arguments that returns a result and which throws a CheckedException) by returning a newBiFunctioninstance
The returnedBiFunction.apply(Object, Object)method delegates directly to theapply(Object, Object)and catches any thrown checkedException's and rethrows them as aCheckedExceptionRethrownException
Unless you provide a context-message (usingsafe(String, CheckedBiFunction)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 aBiFunctionwith the purpose of the calling theBiFunction.apply(Object, Object).static <T1,T2, R> BiFunction<T1, T2, R> CheckedBiFunction.safe(String contextMessage, CheckedBiFunction<T1, T2, R> functionThatCanFailWithACheckedException) Wraps aCheckedBiFunction(basically a lambda with two arguments that returns a result and which throws a CheckedException) by returning a newBiFunctioninstance
The returnedBiFunction.apply(Object, Object)method delegates directly to theapply(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 aBiFunctionwith the purpose of the calling theBiFunction.apply(Object, Object).