Interface ThrowableFunction<T,​R>

  • Type Parameters:
    T - the type of the input to the function
    R - the type of the result of the function
    All Superinterfaces:
    java.util.function.Function<T,​R>
    All Known Subinterfaces:
    ThrowableUnaryOperator<T>
    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 ThrowableFunction<T,​R>
    extends java.util.function.Function<T,​R>
    Represents a function that accepts one argument and produces a result.

    Permits checked exceptions unlike Function

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

    • Method Detail

      • applyUnsafe

        R applyUnsafe​(T t)
               throws java.lang.Throwable
        Applies this function to the given argument.
        Parameters:
        t - the function argument
        Returns:
        the function result
        Throws:
        java.lang.Throwable - occurred during processing
      • apply

        default R apply​(T t)
        Applies this function to the given argument.

        Has default implementation in order to make Function.compose(Function) and Function.andThen(Function) work.

        Specified by:
        apply in interface java.util.function.Function<T,​R>
        Parameters:
        t - the function argument
        Returns:
        the function result
      • identity

        static <T> ThrowableFunction<T,​T> identity()
        Returns a function that always returns its input argument.
        Type Parameters:
        T - the type of the input and output objects to the function
        Returns:
        a function that always returns its input argument