T
-功能的输入类型
R
-函数的结果类型
@FunctionalInterface public interface Function<T,R>
这是一个functional interface其功能的方法是apply(Object)
。
Modifier and Type | Method and Description |
---|---|
default <V> Function<T,V> |
andThen(Function<? super R,? extends V> after)
返回一个由功能首次采用该函数的输入,然后将
after 函数的结果。
|
R |
apply(T t)
将此函数应用于给定的参数。
|
default <V> Function<V,R> |
compose(Function<? super V,? extends T> before)
返回一个由功能,首先应用
before 函数的输入,然后将该函数的结果。
|
static <T> Function<T,T> |
identity()
返回一个函数,它总是返回它的输入参数。
|
default <V> Function<V,R> compose(Function<? super V,? extends T> before)
before
函数的输入,然后将该函数的结果。如果两个函数的评价都抛出一个异常,则将它传递给所合成函数的调用方。
V
到
before
函数输入的类型,并组成功能
before
-功能前应用此功能应用
before
功能并将此功能
NullPointerException
如果之前是空的
andThen(Function)
default <V> Function<T,V> andThen(Function<? super R,? extends V> after)
after
函数的结果。如果两个函数的评价都抛出一个异常,则将它传递给所合成函数的调用方。
V
-
after
函数的输出类型,和组成的函数
after
-功能申请后应用此功能
after
功能
NullPointerException
如果是空的
compose(Function)
static <T> Function<T,T> identity()
T
-函数的输入和输出对象的类型
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.