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:
Function<T,R>
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 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 Summary

    Modifier and Type
    Method
    Description
    default R
    apply(T t)
    Applies this function to the given argument.
    Applies this function to the given argument.
    static <T> ThrowableFunction<T,T>
    Returns a function that always returns its input argument.

    Methods inherited from interface java.util.function.Function

    andThen, compose
  • Method Details

    • applyUnsafe

      R applyUnsafe(T t) throws Throwable
      Applies this function to the given argument.
      Parameters:
      t - the function argument
      Returns:
      the function result
      Throws:
      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 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