public interface Function
| java.util.function.Function<T, R> |
| |
表示接受一个参数并产生结果的函数。
这是一个 functional interface,其功能方法是 apply(Object) 。
公共方法(Public methods) |
|
|---|---|
default <V> Function<T, V> |
andThen(Function<? super R, ? extends V> after) 返回首先将此函数应用于其输入的 |
abstract R |
apply(T t) 将此函数应用于给定的参数。 |
default <V> Function<V, R> |
compose(Function<? super V, ? extends T> before) 返回一个组合函数,它首先将 |
static <T> Function<T, T> |
identity() 返回一个总是返回其输入参数的函数。 |
Function<T, V> andThen (Function<? super R, ? extends V> after)
返回首先将此函数应用于其输入的after函数,然后将after函数应用于结果。 如果对任一函数的求值引发异常,则将其传递给组合函数的调用者。
| 参数(Parameters) | |
|---|---|
after |
Function: the function to apply after this function is applied |
| 返回(Returns) | |
|---|---|
Function<T, V> |
a composed function that first applies this function and then applies the after function |
| 抛出异常(Throws) | |
|---|---|
NullPointerException |
if after is null |
也可以看看:
R apply (T t)
将此函数应用于给定的参数。
| 参数(Parameters) | |
|---|---|
t |
T: the function argument |
| 返回(Returns) | |
|---|---|
R |
the function result |
Function<V, R> compose (Function<? super V, ? extends T> before)
返回一个组合函数,该函数首先将before函数应用于其输入,然后将此函数应用于结果。 如果对任一函数的求值引发异常,则将其传递给组合函数的调用者。
| 参数(Parameters) | |
|---|---|
before |
Function: the function to apply before this function is applied |
| 返回(Returns) | |
|---|---|
Function<V, R> |
a composed function that first applies the before function and then applies this function |
| 抛出异常(Throws) | |
|---|---|
NullPointerException |
if before is null |
也可以看看:
Function<T, T> identity ()
返回一个总是返回其输入参数的函数。
| 返回(Returns) | |
|---|---|
Function<T, T> |
a function that always returns its input argument |