Interface Function<T,R>

Type Parameters:
T - the input type
R - the result type
All Known Subinterfaces:
UnaryOperator<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 Function<T,R>
A function of one argument.
  • Method Summary

    Modifier and Type
    Method
    Description
    default <V> Function<T,V>
    andThen(Function<? super R, ? extends V> after)
    This function, then after on its result.
    apply(T t)
    Applies this function.
    default <V> Function<V,R>
    compose(Function<? super V, ? extends T> before)
    before, then this function on its result.
    static <T> Function<T,T>
    The function that answers its argument.
  • Method Details

    • apply

      R apply(T t)
      Applies this function.
      Parameters:
      t - the input
      Returns:
      the result
    • compose

      default <V> Function<V,R> compose(Function<? super V, ? extends T> before)
      before, then this function on its result.
      Type Parameters:
      V - the input type of before
      Parameters:
      before - the function applied first
      Returns:
      the composed function
    • andThen

      default <V> Function<T,V> andThen(Function<? super R, ? extends V> after)
      This function, then after on its result.
      Type Parameters:
      V - the result type of after
      Parameters:
      after - the function applied next
      Returns:
      the composed function
    • identity

      static <T> Function<T,T> identity()
      The function that answers its argument.
      Type Parameters:
      T - the type
      Returns:
      the identity function