接口 ThrowingBiFunction<T,U,R>
- 类型参数:
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
- 所有超级接口:
BiFunction<T,U, R>
A
BiFunction that allows invocation of code that throws a checked
exception.- 从以下版本开始:
- 4.0
- 作者:
- Stephane Nicoll, Phillip Webb
-
方法概要
修饰符和类型方法说明default 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 create aThrowingBiFunctionwhere theapply(Object, Object)method wraps any checked exception thrown by the supplied lambda expression or method reference.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 create aThrowingBiFunctionwhere 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.从接口继承的方法 java.util.function.BiFunction
andThen
-
方法详细资料
-
applyWithException
Applies this function to the given argument, possibly throwing a checked exception.- 参数:
t- the first function argumentu- the second function argument- 返回:
- the function result
- 抛出:
Exception- on error
-
apply
DefaultBiFunction.apply(Object, Object)that wraps any thrown checked exceptions (by default in aRuntimeException).- 指定者:
apply在接口中BiFunction<T,U, R> - 参数:
t- the first function argumentu- the second function argument- 返回:
- the function result
- 另请参阅:
-
apply
Applies this function to the given argument, wrapping any thrown checked exceptions using the givenexceptionWrapper.- 参数:
t- the first function argumentu- the second function argumentexceptionWrapper-BiFunctionthat wraps the given message and checked exception into a runtime exception- 返回:
- 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.- 参数:
exceptionWrapper-BiFunctionthat wraps the given message and checked exception into a runtime exception- 返回:
- the replacement
ThrowingBiFunctioninstance
-
of
Lambda friendly convenience method that can be used to create aThrowingBiFunctionwhere theapply(Object, Object)method wraps any checked exception thrown by the supplied lambda expression or method reference.This method can be especially useful when working with method references. It allows you to easily convert a method that throws a checked exception into an instance compatible with a regular
BiFunction.For example:
map.replaceAll(ThrowingBiFunction.of(Example::methodThatCanThrowCheckedException));
- 类型参数:
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- 参数:
function- the source function- 返回:
- 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 create aThrowingBiFunctionwhere theapply(Object, Object)method wraps any thrown checked exceptions using the givenexceptionWrapper.This method can be especially useful when working with method references. It allows you to easily convert a method that throws a checked exception into an instance compatible with a regular
BiFunction.For example:
map.replaceAll(ThrowingBiFunction.of(Example::methodThatCanThrowCheckedException, IllegalStateException::new));
- 类型参数:
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- 参数:
function- the source functionexceptionWrapper- the exception wrapper to use- 返回:
- a new
ThrowingFunctioninstance
-