Interface ThrowableBiFunction<T,​U,​R>

  • Type Parameters:
    T - the type of the first argument to be applied for the function
    U - the type of the second argument to be applied for the function
    R - 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>
    BiFunction with Throwable
    Since:
    1.0.0
    See Also:
    Function, Throwable
    • 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 function
        second - 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.NullPointerException
        Type Parameters:
        T - the first argument type
        U - the second argument type
        R - the return type
        Parameters:
        first - the first argument to be applied for the function
        second - the second argument to be applied for the function
        function - ThrowableBiFunction
        Returns:
        the result after execution
        Throws:
        java.lang.NullPointerException - if function is null
      • 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.NullPointerException
        Executes ThrowableBiFunction with the customized exception handling
        Type Parameters:
        T - the first argument type
        U - the second argument type
        R - the return type
        Parameters:
        first - the first argument to be applied for the function
        second - the second argument to be applied for the function
        exceptionHandler - the handler to handle the function argument and the exception that the #apply(T, U) method throws
        function - ThrowableBiFunction
        Returns:
        the result after execution
        Throws:
        java.lang.NullPointerException - if function and exceptionHandler is null