Package io.microsphere.lang.function
Interface ThrowableBiFunction<T,U,R>
-
- Type Parameters:
T- the type of the first argument to be applied for the functionU- the type of the second argument to be applied for the functionR- the type of the result of the function
- 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 ThrowableBiFunction<T,U,R>BiFunctionwithThrowable- Since:
- 1.0.0
- See Also:
Function,Throwable
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceThrowableBiFunction.ExceptionHandler<T,U,R>The handler interface forexception
-
Field Summary
Fields Modifier and Type Field Description static ThrowableBiFunction.ExceptionHandlerDEFAULT_EXCEPTION_HANDLER
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Rapply(T first, U second)Applies this function to the given argument.static <T,U,R>
Rexecute(T first, U second, ThrowableBiFunction<T,U,R> function)ExecutesThrowableBiFunctionwiththe default exception handlingstatic <T,U,R>
Rexecute(T first, U second, ThrowableBiFunction<T,U,R> function, ThrowableBiFunction.ExceptionHandler<T,U,R> exceptionHandler)ExecutesThrowableBiFunctionwith the customized exception handling
-
-
-
Field Detail
-
DEFAULT_EXCEPTION_HANDLER
static final ThrowableBiFunction.ExceptionHandler DEFAULT_EXCEPTION_HANDLER
-
-
Method Detail
-
apply
R apply(T first, U second) throws java.lang.Throwable
Applies this function to the given argument.- Parameters:
first- the first argument to be applied for the functionsecond- the second argument to be applied for the function- Returns:
- the function result
- Throws:
java.lang.Throwable- if met with any error
-
execute
static <T,U,R> R execute(T first, U second, ThrowableBiFunction<T,U,R> function) throws java.lang.NullPointerExceptionExecutesThrowableBiFunctionwiththe default exception handling- Type Parameters:
T- the first argument typeU- the second argument typeR- the return type- Parameters:
first- the first argument to be applied for the functionsecond- the second argument to be applied for the functionfunction-ThrowableBiFunction- Returns:
- the result after execution
- Throws:
java.lang.NullPointerException- iffunctionisnull
-
execute
static <T,U,R> R execute(T first, U second, ThrowableBiFunction<T,U,R> function, ThrowableBiFunction.ExceptionHandler<T,U,R> exceptionHandler) throws java.lang.NullPointerExceptionExecutesThrowableBiFunctionwith the customized exception handling- Type Parameters:
T- the first argument typeU- the second argument typeR- the return type- Parameters:
first- the first argument to be applied for the functionsecond- the second argument to be applied for the functionexceptionHandler- the handler to handle the function argument and the exception that the#apply(T, U)method throwsfunction-ThrowableBiFunction- Returns:
- the result after execution
- Throws:
java.lang.NullPointerException- iffunctionandexceptionHandlerisnull
-
-