- Type Parameters:
T- 参数类型R- 返回值类型
- All Superinterfaces:
Function<T,,R> Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
可序列化的Function接口,支持异常抛出。
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Method Summary
-
Method Details
-
identity
返回一个始终返回输入参数的函数。- Type Parameters:
T- 函数输入和输出的类型- Returns:
- 始终返回输入参数的函数
-
castingIdentity
返回一个支持类型转换的恒等函数。- Type Parameters:
T- 输入参数类型R- 返回值类型- Returns:
- 类型转换后的恒等函数
-
applying
对给定参数应用此函数,可能抛出异常。- Parameters:
t- 函数输入参数- Returns:
- 函数执行结果
- Throws:
Throwable- 可能抛出的异常
-
apply
对给定参数应用此函数,自动处理异常。- Specified by:
applyin interfaceFunction<T,R> - Parameters:
t- 函数输入参数- Returns:
- 函数执行结果
- Throws:
RuntimeException- 包装后的运行时异常
-