-  
       
- 参数类型
 -  
         
T- 函数输入的类型 -  
         
R- 函数结果的类型 
- All Known Subinterfaces:
 -  
         
UnaryOperator<T> 
- Functional Interface:
 - 这是一个功能接口,因此可以用作lambda表达式或方法引用的赋值目标。
 
@FunctionalInterface public interface Function<T,R>
表示接受一个参数并生成结果的函数。这是一个functional interface,其功能方法是
apply(Object)。- 从以下版本开始:
 - 1.8
 
 
-  
        
       
-  
             
方法摘要
所有方法 静态方法 实例方法 抽象方法 Default Methods 变量和类型 方法 描述 default <V> Function<T,V>andThen(Function<? super R,? extends V> after)返回首先将此函数应用于其输入的after函数,然后将after函数应用于结果。Rapply(T t)将此函数应用于给定的参数。default <V> Function<V,R>compose(Function<? super V,? extends T> before)返回一个组合函数,该函数首先将before函数应用于其输入,然后将此函数应用于结果。static <T> Function<T,T>identity()返回一个始终返回其输入参数的函数。 
 -  
             
 
-  
        
       
-  
             
方法详细信息
-  
compose
default <V> Function<V,R> compose(Function<? super V,? extends T> before)
返回一个组合函数,该函数首先将before函数应用于其输入,然后将此函数应用于结果。 如果对任一函数的求值抛出异常,则将其转发给组合函数的调用者。- 参数类型
 -  
              
V-before函数和组合函数的输入类型 - 参数
 -  
              
before- 应用此函数之前应用的函数 - 结果
 - 
               一个组合函数,首先应用 
              
before函数,然后应用此函数 - 异常
 -  
              
NullPointerException- 如果before为null - 另请参见:
 -  
              
andThen(Function) 
 
-  
andThen
default <V> Function<T,V> andThen(Function<? super R,? extends V> after)
返回首先将此函数应用于其输入的after函数,然后将after函数应用于结果。 如果对任一函数的求值抛出异常,则将其转发给组合函数的调用者。- 参数类型
 -  
              
V-after函数的输出类型,以及组合函数的输出类型 - 参数
 -  
              
after- 应用此功能后应用的功能 - 结果
 - 
               一个组合函数,首先应用此函数,然后应用 
              
after函数 - 异常
 -  
              
NullPointerException- 如果after为null - 另请参见:
 -  
              
compose(Function) 
 
-  
identity
static <T> Function<T,T> identity()
返回一个始终返回其输入参数的函数。- 参数类型
 -  
              
T- 函数的输入和输出对象的类型 - 结果
 - 一个总是返回其输入参数的函数
 
 
 -  
 
 -