20230529 java.util.function.Function

发布时间 2023-08-30 17:22:01作者: 流星<。)#)))≦

介绍

  • java.util.function.Function
  • 接口声明
@FunctionalInterface
public interface Function<T, R>

API

static

  • identity
    • 返回入参

public

  • apply
    • R apply(T t);
    • 将此函数应用于给定的参数
    • 函数式方法

default

  • compose
    • <V> Function<V, R> compose(Function<? super V, ? extends T> before)
    • 返回一个复合函数,该函数首先将 before 函数应用于其输入,然后将当前函数应用于结果
  • andThen
    • <V> Function<T, V> andThen(Function<? super R, ? extends V> after)
    • 返回一个复合函数,该函数首先将当前函数应用于其输入,然后将 after 函数应用于结果