Class Functions


  • public final class Functions
    extends Object
    A set of utility methods which return common functions.
    • Method Detail

      • runnableConsumer

        public static Consumer<Runnable> runnableConsumer()
        Get the singleton consumer which accepts and runs runnable instances.
        Returns:
        the runnable consumer
      • exceptionRunnableConsumer

        public static <E extends ExceptionExceptionConsumer<ExceptionRunnable<E>,​E> exceptionRunnableConsumer()
        Get the singleton exception consumer which accepts and runs exception runnable instances.
        Type Parameters:
        E - the exception type
        Returns:
        the runnable consumer
      • runnableExceptionConsumer

        public static ExceptionConsumer<Runnable,​RuntimeException> runnableExceptionConsumer()
        Get the singleton exception consumer which accepts and runs runnable instances.
        Returns:
        the runnable consumer
      • consumerBiConsumer

        public static <T> BiConsumer<Consumer<T>,​T> consumerBiConsumer()
        Get the singleton consumer which accepts a consumer and an argument to hand to it.
        Type Parameters:
        T - the argument type
        Returns:
        the consumer
      • exceptionConsumerBiConsumer

        public static <T,​E extends ExceptionExceptionBiConsumer<ExceptionConsumer<T,​E>,​T,​E> exceptionConsumerBiConsumer()
        Get the singleton consumer which accepts a consumer and an argument to hand to it.
        Type Parameters:
        T - the argument type
        E - the exception type
        Returns:
        the consumer
      • consumerExceptionBiConsumer

        public static <T> ExceptionBiConsumer<Consumer<T>,​T,​RuntimeException> consumerExceptionBiConsumer()
        Get the singleton consumer which accepts a consumer and an argument to hand to it.
        Type Parameters:
        T - the argument type
        Returns:
        the consumer
      • supplierFunction

        public static <R> Function<Supplier<R>,​R> supplierFunction()
        Get the singleton function which accepts a supplier and returns the result of the supplier.
        Type Parameters:
        R - the result type
        Returns:
        the function
      • exceptionSupplierFunction

        public static <R,​E extends ExceptionExceptionFunction<ExceptionSupplier<R,​E>,​R,​E> exceptionSupplierFunction()
        Get the singleton function which accepts a supplier and returns the result of the supplier.
        Type Parameters:
        R - the result type
        E - the exception type
        Returns:
        the function
      • supplierExceptionFunction

        public static <R> ExceptionFunction<Supplier<R>,​R,​RuntimeException> supplierExceptionFunction()
        Get the singleton function which accepts a supplier and returns the result of the supplier.
        Type Parameters:
        R - the result type
        Returns:
        the function
      • supplierFunctionBiFunction

        public static <R> BiFunction<Function<Supplier<R>,​R>,​Supplier<R>,​R> supplierFunctionBiFunction()
        Get the singleton function which accepts a function which accepts a supplier, all of which return the result of the supplier.
        Type Parameters:
        R - the result type
        Returns:
        the function
      • exceptionSupplierFunctionBiFunction

        public static <R,​E extends ExceptionExceptionBiFunction<ExceptionFunction<ExceptionSupplier<R,​E>,​R,​E>,​ExceptionSupplier<R,​E>,​R,​E> exceptionSupplierFunctionBiFunction()
        Get the singleton function which accepts a function which accepts a supplier, all of which return the result of the supplier.
        Type Parameters:
        R - the result type
        E - the exception type
        Returns:
        the function
      • functionBiFunction

        public static <T,​R> BiFunction<Function<T,​R>,​T,​R> functionBiFunction()
        Get the singleton function which accepts a function and a parameter to pass to the function, and returns the result of the function.
        Type Parameters:
        T - the argument type
        R - the result type
        Returns:
        the function
      • exceptionFunctionBiFunction

        public static <T,​R,​E extends ExceptionExceptionBiFunction<ExceptionFunction<T,​R,​E>,​T,​R,​E> exceptionFunctionBiFunction()
        Get the singleton function which accepts a function and a parameter to pass to the function, and returns the result of the function.
        Type Parameters:
        T - the argument type
        R - the result type
        E - the exception type
        Returns:
        the function
      • functionExceptionBiFunction

        public static <T,​R> ExceptionBiFunction<Function<T,​R>,​T,​R,​RuntimeException> functionExceptionBiFunction()
        Get the singleton function which accepts a function and a parameter to pass to the function, and returns the result of the function.
        Type Parameters:
        T - the argument type
        R - the result type
        Returns:
        the function
      • constantSupplier

        public static <T> Supplier<T> constantSupplier​(T value)
        Get a supplier which always returns the same value.
        Type Parameters:
        T - the value type
        Parameters:
        value - the value to return
        Returns:
        the value supplier
      • constantExceptionSupplier

        public static <T,​E extends ExceptionExceptionSupplier<T,​E> constantExceptionSupplier​(T value)
        Get a supplier which always returns the same value.
        Type Parameters:
        T - the value type
        E - the exception type
        Parameters:
        value - the value to return
        Returns:
        the value supplier
      • capturingRunnable

        public static <T,​U> Runnable capturingRunnable​(BiConsumer<T,​U> consumer,
                                                             T param1,
                                                             U param2)
        Get a runnable which executes the given consumer with captured values.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        Parameters:
        consumer - the consumer to run (must not be null)
        param1 - the first parameter to pass
        param2 - the second parameter to pass
        Returns:
        the capturing runnable
      • capturingRunnable

        public static <T> Runnable capturingRunnable​(Consumer<T> consumer,
                                                     T param)
        Get a runnable which executes the given consumer with captured values.
        Type Parameters:
        T - the parameter type
        Parameters:
        consumer - the consumer to run (must not be null)
        param - the parameter to pass
        Returns:
        the capturing runnable
      • exceptionCapturingRunnable

        public static <T,​U,​E extends ExceptionExceptionRunnable<E> exceptionCapturingRunnable​(ExceptionBiConsumer<T,​U,​E> consumer,
                                                                                                            T param1,
                                                                                                            U param2)
        Get a runnable which executes the given consumer with captured values.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        E - the exception type
        Parameters:
        consumer - the consumer to run (must not be null)
        param1 - the first parameter to pass
        param2 - the second parameter to pass
        Returns:
        the capturing runnable
      • exceptionCapturingRunnable

        public static <T,​E extends ExceptionExceptionRunnable<E> exceptionCapturingRunnable​(ExceptionConsumer<T,​E> consumer,
                                                                                                    T param)
        Get a runnable which executes the given consumer with captured values.
        Type Parameters:
        T - the parameter type
        E - the exception type
        Parameters:
        consumer - the consumer to run (must not be null)
        param - the parameter to pass
        Returns:
        the capturing runnable
      • discardingConsumer

        public static <T> Consumer<T> discardingConsumer()
        Get a consumer which discards the values it is given.
        Type Parameters:
        T - the parameter type
        Returns:
        the discarding consumer
      • discardingExceptionConsumer

        public static <T,​E extends ExceptionExceptionConsumer<T,​E> discardingExceptionConsumer()
        Get a consumer which discards the values it is given.
        Type Parameters:
        T - the parameter type
        E - the exception type
        Returns:
        the discarding consumer
      • discardingBiConsumer

        public static <T,​U> BiConsumer<T,​U> discardingBiConsumer()
        Get a consumer which discards the values it is given.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        Returns:
        the discarding consumer
      • discardingExceptionBiConsumer

        public static <T,​U,​E extends ExceptionExceptionBiConsumer<T,​U,​E> discardingExceptionBiConsumer()
        Get a consumer which discards the values it is given.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        E - the exception type
        Returns:
        the discarding consumer
      • closingConsumer

        public static <T extends AutoCloseableConsumer<T> closingConsumer()
        Returns a consumer that quietly closes its argument, logging any exceptions.
        Returns:
        a closing consumer
      • exceptionLoggingConsumer

        public static <E extends ExceptionConsumer<E> exceptionLoggingConsumer()
        Returns a consumer that logs its exception parameter as a warning.
        Type Parameters:
        E - the exception type
        Returns:
        an exception consumer
      • runtimeExceptionThrowingConsumer

        public static <E extends Exception,​RE extends RuntimeExceptionConsumer<E> runtimeExceptionThrowingConsumer​(Function<E,​RE> wrapper)
        Returns a consumer that wraps and throws its exception parameter as a RuntimeException.
        Type Parameters:
        E - the exception type
        Parameters:
        wrapper - a runtime exception wrapper
        Returns:
        an exception consumer
      • quiet

        public static <T,​E extends ExceptionConsumer<T> quiet​(ExceptionConsumer<T,​E> consumer,
                                                                      Consumer<E> handler)
        Converts an ExceptionConsumer to a standard Consumer using the specified exception handler.
        Type Parameters:
        T - the parameter type of the consumer
        E - the exception type
        Parameters:
        consumer - an exception consumer
        handler - an exception handler
        Returns:
        a standard consumer
      • quiet

        public static <T,​U,​E extends ExceptionBiConsumer<T,​U> quiet​(ExceptionBiConsumer<T,​U,​E> consumer,
                                                                                        Consumer<E> handler)
        Converts an ExceptionBiConsumer to a standard BiConsumer using the specified exception handler.
        Type Parameters:
        T - the first parameter type of the consumer
        U - the second parameter type of the consumer
        E - the exception type
        Parameters:
        consumer - a binary exception consumer
        handler - an exception handler
        Returns:
        a standard binary consumer
      • quiet

        public static <T,​E extends ExceptionObjIntConsumer<T> quiet​(ExceptionObjIntConsumer<T,​E> consumer,
                                                                            Consumer<E> handler)
        Converts an ExceptionObjIntConsumer to a standard ObjIntConsumer using the specified exception handler.
        Type Parameters:
        T - the first parameter type of the consumer
        E - the exception type
        Parameters:
        consumer - an object/int exception consumer
        handler - an exception handler
        Returns:
        a standard object/int consumer
      • cast

        public static <T,​TT extends T> Consumer<TT> cast​(Consumer<T> consumer)
        Returns a Consumer with identical behavior to the specified Consumer but with restricted parameter type.
        Type Parameters:
        T - the parameter type
        TT - the restricted parameter type
        Parameters:
        consumer - a consumer
        Returns:
        a functionally equivalent consumer
      • cast

        public static <T,​TT extends T> Predicate<TT> cast​(Predicate<T> predicate)
        Returns a Predicate with identical behavior to the specified Predicate but with restricted parameter type.
        Type Parameters:
        T - the parameter type
        TT - the restricted parameter type
        Parameters:
        predicate - a predicate
        Returns:
        a functionally equivalent predicate
      • cast

        public static <T extends TT,​TT> Supplier<TT> cast​(Supplier<T> supplier)
        Returns a Supplier with identical behavior to the specified Supplier but with relaxed return type.
        Type Parameters:
        T - the return type
        TT - the relaxed return type
        Parameters:
        supplier - a supplier
        Returns:
        a functionally equivalent supplier
      • cast

        public static <T,​R extends RR,​TT extends T,​RR> Function<TT,​RR> cast​(Function<T,​R> function)
        Returns a Function with identical behavior to the specified Function but with restricted parameter type and relaxed return type.
        Type Parameters:
        T - the parameter type
        R - the return type
        TT - the restricted parameter type
        RR - the relaxed return type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <R extends RR,​RR> DoubleFunction<RR> cast​(DoubleFunction<R> function)
        Returns a DoubleFunction with identical behavior to the specified DoubleFunction but with relaxed return type.
        Type Parameters:
        R - the return type
        RR - the relaxed return type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <R extends RR,​RR> IntFunction<RR> cast​(IntFunction<R> function)
        Returns a IntFunction with identical behavior to the specified IntFunction but with relaxed return type.
        Type Parameters:
        R - the return type
        RR - the relaxed return type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <R extends RR,​RR> LongFunction<RR> cast​(LongFunction<R> function)
        Returns a LongFunction with identical behavior to the specified LongFunction but with relaxed return type.
        Type Parameters:
        R - the return type
        RR - the relaxed return type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​TT extends T> ToDoubleFunction<TT> cast​(ToDoubleFunction<T> function)
        Returns a ToDoubleFunction with identical behavior to the specified ToDoubleFunction but with restricted parameter type.
        Type Parameters:
        T - the parameter type
        TT - the restricted parameter type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​TT extends T> ToIntFunction<TT> cast​(ToIntFunction<T> function)
        Returns a ToIntFunction with identical behavior to the specified ToIntFunction but with restricted parameter type.
        Type Parameters:
        T - the parameter type
        TT - the restricted parameter type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​TT extends T> ToLongFunction<TT> cast​(ToLongFunction<T> function)
        Returns a ToLongFunction with identical behavior to the specified ToLongFunction but with restricted parameter type.
        Type Parameters:
        T - the parameter type
        TT - the restricted parameter type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​U,​TT extends T,​UU extends U> BiConsumer<TT,​UU> cast​(BiConsumer<T,​U> consumer)
        Returns a BiConsumer with identical behavior to the specified BiConsumer but with restricted parameter types.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        TT - the restricted first parameter type
        UU - the restricted second parameter type
        Parameters:
        consumer - a consumer
        Returns:
        a functionally equivalent consumer
      • cast

        public static <T,​TT extends T> ObjDoubleConsumer<TT> cast​(ObjDoubleConsumer<T> consumer)
        Returns a ObjDoubleConsumer with identical behavior to the specified ObjDoubleConsumer but with restricted parameter type.
        Type Parameters:
        T - the parameter type
        TT - the restricted parameter type
        Parameters:
        consumer - a consumer
        Returns:
        a functionally equivalent consumer
      • cast

        public static <T,​TT extends T> ObjIntConsumer<TT> cast​(ObjIntConsumer<T> consumer)
        Returns a ObjIntConsumer with identical behavior to the specified ObjIntConsumer but with restricted parameter type.
        Type Parameters:
        T - the parameter type
        TT - the restricted parameter type
        Parameters:
        consumer - a consumer
        Returns:
        a functionally equivalent consumer
      • cast

        public static <T,​TT extends T> ObjLongConsumer<TT> cast​(ObjLongConsumer<T> consumer)
        Returns a ObjLongConsumer with identical behavior to the specified ObjLongConsumer but with restricted parameter type.
        Type Parameters:
        T - the parameter type
        TT - the restricted parameter type
        Parameters:
        consumer - a consumer
        Returns:
        a functionally equivalent consumer
      • cast

        public static <T,​U,​TT extends T,​UU extends U> BiPredicate<TT,​UU> cast​(BiPredicate<T,​U> predicate)
        Returns a BiPredicate with identical behavior to the specified BiPredicate but with restricted parameter types.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        TT - the restricted first parameter type
        UU - the restricted second parameter type
        Parameters:
        predicate - a predicate
        Returns:
        a functionally equivalent predicate
      • cast

        public static <T,​U,​R extends RR,​TT extends T,​UU extends U,​RR> BiFunction<TT,​UU,​RR> cast​(BiFunction<T,​U,​R> function)
        Returns a BiFunction with identical behavior to the specified BiFunction but with restricted parameter types and relaxed return type.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        R - the return type
        TT - the restricted first parameter type
        UU - the restricted second parameter type
        RR - the relaxed return type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​U,​TT extends T,​UU extends U> ToDoubleBiFunction<TT,​UU> cast​(ToDoubleBiFunction<T,​U> function)
        Returns a ToDoubleBiFunction with identical behavior to the specified ToDoubleBiFunction but with restricted parameter types.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        TT - the restricted first parameter type
        UU - the restricted second parameter type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​U,​TT extends T,​UU extends U> ToIntBiFunction<TT,​UU> cast​(ToIntBiFunction<T,​U> function)
        Returns a ToIntBiFunction with identical behavior to the specified ToIntBiFunction but with restricted parameter types.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        TT - the restricted first parameter type
        UU - the restricted second parameter type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​U,​TT extends T,​UU extends U> ToLongBiFunction<TT,​UU> cast​(ToLongBiFunction<T,​U> function)
        Returns a ToLongBiFunction with identical behavior to the specified ToLongBiFunction but with restricted parameter types.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        TT - the restricted first parameter type
        UU - the restricted second parameter type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​E extends EE,​TT extends T,​EE extends ExceptionExceptionConsumer<TT,​EE> cast​(ExceptionConsumer<T,​E> consumer)
        Returns a ExceptionConsumer with identical behavior to the specified ExceptionConsumer but with restricted parameter type and relaxed exception type.
        Type Parameters:
        T - the parameter type
        E - the exception type
        TT - the restricted parameter type
        EE - the relaxed exception type
        Parameters:
        consumer - a consumer
        Returns:
        a functionally equivalent consumer
      • cast

        public static <T,​E extends EE,​TT extends T,​EE extends ExceptionExceptionPredicate<TT,​EE> cast​(ExceptionPredicate<T,​E> consumer)
        Returns a ExceptionPredicate with identical behavior to the specified ExceptionPredicate but with restricted parameter type and relaxed exception type.
        Type Parameters:
        T - the parameter type
        E - the exception type
        TT - the restricted parameter type
        EE - the relaxed exception type
        Parameters:
        consumer - a consumer
        Returns:
        a functionally equivalent predicate
      • cast

        public static <T extends TT,​E extends EE,​TT,​EE extends ExceptionExceptionSupplier<TT,​EE> cast​(ExceptionSupplier<T,​E> supplier)
        Returns a ExceptionSupplier with identical behavior to the specified ExceptionSupplier but with relaxed return type and relaxed exception type.
        Type Parameters:
        T - the return type
        E - the exception type
        TT - the relaxed return type
        EE - the relaxed exception type
        Parameters:
        supplier - a supplier
        Returns:
        a functionally equivalent supplier
      • cast

        public static <T,​R extends RR,​E extends EE,​TT extends T,​RR,​EE extends ExceptionExceptionFunction<TT,​RR,​EE> cast​(ExceptionFunction<T,​R,​E> function)
        Returns a ExceptionFunction with identical behavior to the specified ExceptionFunction but with restricted parameter type, relaxed return type, and relaxed exception type.
        Type Parameters:
        T - the parameter type
        R - the return type
        E - the exception type
        TT - the restricted parameter type
        RR - the relaxed return type
        EE - the relaxed exception type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <R extends RR,​E extends EE,​RR,​EE extends ExceptionExceptionIntFunction<RR,​EE> cast​(ExceptionIntFunction<R,​E> function)
        Returns a ExceptionIntFunction with identical behavior to the specified ExceptionFunction but with relaxed return type and relaxed exception type.
        Type Parameters:
        R - the return type
        E - the exception type
        RR - the relaxed return type
        EE - the relaxed exception type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <R extends RR,​E extends EE,​RR,​EE extends ExceptionExceptionLongFunction<RR,​EE> cast​(ExceptionLongFunction<R,​E> function)
        Returns a ExceptionLongFunction with identical behavior to the specified ExceptionLongFunction but with relaxed return type and relaxed exception type.
        Type Parameters:
        R - the return type
        E - the exception type
        RR - the relaxed return type
        EE - the relaxed exception type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​E extends EE,​TT extends T,​EE extends ExceptionExceptionToIntFunction<TT,​EE> cast​(ExceptionToIntFunction<T,​E> function)
        Returns a ExceptionToIntFunction with identical behavior to the specified ExceptionToIntFunction but with restricted parameter type and relaxed exception type.
        Type Parameters:
        T - the parameter type
        E - the exception type
        TT - the restricted parameter type
        EE - the relaxed exception type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​E extends EE,​TT extends T,​EE extends ExceptionExceptionToLongFunction<TT,​EE> cast​(ExceptionToLongFunction<T,​E> function)
        Returns a ExceptionToLongFunction with identical behavior to the specified ExceptionToLongFunction but with restricted parameter type and relaxed exception type.
        Type Parameters:
        T - the parameter type
        E - the exception type
        TT - the restricted parameter type
        EE - the relaxed exception type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​E extends EE,​TT extends T,​U,​UU extends U,​EE extends ExceptionExceptionBiConsumer<TT,​UU,​EE> cast​(ExceptionBiConsumer<T,​U,​E> consumer)
        Returns a ExceptionBiConsumer with identical behavior to the specified ExceptionBiConsumer but with restricted parameter types and relaxed exception type.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        E - the exception type
        TT - the restricted first parameter type
        UU - the restricted second parameter type
        EE - the relaxed exception type
        Parameters:
        consumer - a consumer
        Returns:
        a functionally equivalent consumer
      • cast

        public static <T,​E extends EE,​TT extends T,​EE extends ExceptionExceptionObjIntConsumer<TT,​EE> cast​(ExceptionObjIntConsumer<T,​E> consumer)
        Returns a ExceptionObjIntConsumer with identical behavior to the specified ExceptionObjIntConsumer but with restricted parameter type and relaxed exception type.
        Type Parameters:
        T - the parameter type
        E - the exception type
        TT - the restricted parameter type
        EE - the relaxed exception type
        Parameters:
        consumer - a consumer
        Returns:
        a functionally equivalent consumer
      • cast

        public static <T,​E extends EE,​TT extends T,​EE extends ExceptionExceptionObjLongConsumer<TT,​EE> cast​(ExceptionObjLongConsumer<T,​E> consumer)
        Returns a ExceptionObjLongConsumer with identical behavior to the specified ExceptionObjLongConsumer but with restricted parameter type and relaxed exception type.
        Type Parameters:
        T - the parameter type
        E - the exception type
        TT - the restricted parameter type
        EE - the relaxed exception type
        Parameters:
        consumer - a consumer
        Returns:
        a functionally equivalent consumer
      • cast

        public static <T,​U,​E extends EE,​TT extends T,​UU extends U,​EE extends ExceptionExceptionBiPredicate<TT,​UU,​EE> cast​(ExceptionBiPredicate<T,​U,​E> predicate)
        Returns a ExceptionBiPredicate with identical behavior to the specified ExceptionBiPredicate but with restricted parameter types and relaxed exception type.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        E - the exception type
        TT - the restricted first parameter type
        UU - the restricted second parameter type
        EE - the relaxed exception type
        Parameters:
        predicate - a predicate
        Returns:
        a functionally equivalent predicate
      • cast

        public static <T,​U,​R extends RR,​E extends EE,​TT extends T,​UU extends U,​RR,​EE extends ExceptionExceptionBiFunction<TT,​UU,​RR,​EE> cast​(ExceptionBiFunction<T,​U,​R,​E> function)
        Returns a ExceptionBiFunction with identical behavior to the specified ExceptionBiFunction but with restricted parameter types, relaxed return type, and relaxed exception type.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        R - the return type
        E - the exception type
        TT - the restricted first parameter type
        UU - the restricted second parameter type
        RR - the relaxed return type
        EE - the relaxed exception type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​U,​E extends EE,​TT extends T,​UU extends U,​EE extends ExceptionExceptionToIntBiFunction<TT,​UU,​EE> cast​(ExceptionToIntBiFunction<T,​U,​E> function)
        Returns a ExceptionToIntBiFunction with identical behavior to the specified ExceptionToIntBiFunction but with restricted parameter types and relaxed exception type.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        E - the exception type
        TT - the restricted first parameter type
        UU - the restricted second parameter type
        EE - the relaxed exception type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function
      • cast

        public static <T,​U,​E extends EE,​TT extends T,​UU extends U,​EE extends ExceptionExceptionToLongBiFunction<TT,​UU,​EE> cast​(ExceptionToLongBiFunction<T,​U,​E> function)
        Returns a ExceptionToLongBiFunction with identical behavior to the specified ExceptionToLongBiFunction but with restricted parameter types and relaxed exception type.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        E - the exception type
        TT - the restricted first parameter type
        UU - the restricted second parameter type
        EE - the relaxed exception type
        Parameters:
        function - a function
        Returns:
        a functionally equivalent function