Interface ThrowingBiFunction<T,U,R>
- Type Parameters:
T- the type of the first argument to the functionU- the type of the second argument to the functionR- the type of the result of the function
- All Superinterfaces:
BiFunction<T,U, R>
A
BiFunction that allows invocation of code that throws a checked
exception.- Since:
- 6.0
- Author:
- Stephane Nicoll, Phillip Webb
-
Method Summary
Modifier and TypeMethodDescriptiondefault RDefaultBiFunction.apply(Object, Object)that wraps any thrown checked exceptions (by default in aRuntimeException).default Rapply(T t, U u, BiFunction<String, Exception, RuntimeException> exceptionWrapper) Applies this function to the given argument, wrapping any thrown checked exceptions using the givenexceptionWrapper.applyWithException(T t, U u) Applies this function to the given argument, possibly throwing a checked exception.static <T,U, R> ThrowingBiFunction<T, U, R> of(ThrowingBiFunction<T, U, R> function) Lambda friendly convenience method that can be used to createThrowingBiFunctionwhere theapply(Object, Object)method wraps any thrown checked exceptions using the givenexceptionWrapper.static <T,U, R> ThrowingBiFunction<T, U, R> of(ThrowingBiFunction<T, U, R> function, BiFunction<String, Exception, RuntimeException> exceptionWrapper) Lambda friendly convenience method that can be used to createThrowingBiFunctionwhere theapply(Object, Object)method wraps any thrown checked exceptions using the givenexceptionWrapper.default ThrowingBiFunction<T,U, R> throwing(BiFunction<String, Exception, RuntimeException> exceptionWrapper) Return a newThrowingBiFunctionwhere theapply(Object, Object)method wraps any thrown checked exceptions using the givenexceptionWrapper.Methods inherited from interface java.util.function.BiFunction
andThen
-
Method Details
-
applyWithException
Applies this function to the given argument, possibly throwing a checked exception.- Parameters:
t- the first function argumentu- the second function argument- Returns:
- the function result
- Throws:
Exception- on error
-
apply
DefaultBiFunction.apply(Object, Object)that wraps any thrown checked exceptions (by default in aRuntimeException).- Specified by:
applyin interfaceBiFunction<T,U, R> - Parameters:
t- the first function argumentu- the second function argument- Returns:
- the function result
- See Also:
-
apply
Applies this function to the given argument, wrapping any thrown checked exceptions using the givenexceptionWrapper.- Parameters:
t- the first function argumentu- the second function argumentexceptionWrapper-BiFunctionthat wraps the given message and checked exception into a runtime exception- Returns:
- a result
-
throwing
default ThrowingBiFunction<T,U, throwingR> (BiFunction<String, Exception, RuntimeException> exceptionWrapper) Return a newThrowingBiFunctionwhere theapply(Object, Object)method wraps any thrown checked exceptions using the givenexceptionWrapper.- Parameters:
exceptionWrapper-BiFunctionthat wraps the given message and checked exception into a runtime exception- Returns:
- the replacement
ThrowingBiFunctioninstance
-
of
Lambda friendly convenience method that can be used to createThrowingBiFunctionwhere theapply(Object, Object)method wraps any thrown checked exceptions using the givenexceptionWrapper.- Type Parameters:
T- the type of the first argument to the functionU- the type of the second argument to the functionR- the type of the result of the function- Parameters:
function- the source function- Returns:
- a new
ThrowingFunctioninstance
-
of
static <T,U, ThrowingBiFunction<T,R> U, ofR> (ThrowingBiFunction<T, U, R> function, BiFunction<String, Exception, RuntimeException> exceptionWrapper) Lambda friendly convenience method that can be used to createThrowingBiFunctionwhere theapply(Object, Object)method wraps any thrown checked exceptions using the givenexceptionWrapper.- Type Parameters:
T- the type of the first argument to the functionU- the type of the second argument to the functionR- the type of the result of the function- Parameters:
function- the source functionexceptionWrapper- the exception wrapper to use- Returns:
- a new
ThrowingFunctioninstance
-