Interface ThrowingFunction<T,​R,​E extends java.lang.Throwable>

  • Type Parameters:
    T - the type of argument passed to the function
    R - the type of results returned by the function
    E - the type of exception that the function throws
    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 ThrowingFunction<T,​R,​E extends java.lang.Throwable>
    The same as Function, but the lambda expression throws an E checked exception.

    This is a functional interface whose functional method is apply(Object)

    Since:
    v0.1.0
    • Method Detail

      • apply

        R apply​(T t)
         throws E extends java.lang.Throwable
        Applies this function to the given argument, or throws an exception.
        Parameters:
        t - the function argument
        Returns:
        the function result
        Throws:
        E - which extends from Throwable
        E extends java.lang.Throwable
      • identity

        static <T,​E extends java.lang.Throwable> ThrowingFunction<T,​T,​E> identity()
        Returns a function that always returns its input argument.
        Type Parameters:
        T - the type of the input and output objects to the function
        E - the type of exception that the function throws
        Returns:
        a function that always returns its input argument