Interface TFunction<T,R>

Type Parameters:
T - The argument type
R - The return type
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 TFunction<T,R>
This is a functional interface that can be used to replace Function and throw exceptions.
  • Method Summary

    Modifier and Type
    Method
    Description
    default <V> TFunction<T,V>
    andThen(TFunction<? super R,? extends V> after)
     
    apply(T t)
    Applies this function to the given argument and throws an exception.
    default <V> TFunction<V,R>
    compose(TFunction<? super V,? extends T> before)
     
    static <T> TFunction<T,T>
     
  • Method Details

    • apply

      R apply(T t) throws Throwable
      Applies this function to the given argument and throws an exception.
      Parameters:
      t - The argument
      Returns:
      The return value
      Throws:
      Throwable - The exception
    • compose

      default <V> TFunction<V,R> compose(TFunction<? super V,? extends T> before)
      Type Parameters:
      V - The argument type of the before function, and of the composed function
      Parameters:
      before - The operation to perform before this operation
      Returns:
      A composed TFunction that performs in sequence the before operation followed by this operation
    • andThen

      default <V> TFunction<T,V> andThen(TFunction<? super R,? extends V> after)
      Type Parameters:
      V - The return type of the after function, and of the composed function
      Parameters:
      after - The operation to perform after this operation
      Returns:
      A composed TFunction that performs in sequence this operation followed by the after
    • identity

      static <T> TFunction<T,T> identity()
      Type Parameters:
      T - The argument type
      Returns:
      A function that always returns its input argument.