Interface TriFunction<T1,T2,T3,R>
- Type Parameters:
T1- first input type - 第一个输入类型T2- second input type - 第二个输入类型T3- third input type - 第三个输入类型R- return type - 返回值类型
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
TriFunction - Three-argument function
TriFunction - 三参函数
Represents a function that accepts three arguments and produces a result.
表示接受三个参数并产生结果的函数。
Features | 主要功能:
- Three input parameters - 三个输入参数
- Composition support (andThen) - 支持函数组合
- Works with Validation.combine - 与 Validation.combine 配合使用
Usage Examples | 使用示例:
TriFunction<String, Integer, Boolean, User> createUser =
(name, age, active) -> new User(name, age, active);
User user = createUser.apply("Alice", 25, true);
// With composition
TriFunction<String, Integer, Boolean, String> createAndFormat =
createUser.andThen(User::toString);
// With Validation
Validation<String, User> result = Validation.combine(
validateName(name),
validateAge(age),
validateActive(active),
createUser
);
Security | 安全性:
- Thread-safe: Yes (stateless) - 线程安全: 是 (无状态)
- Null-safe: No - 空值安全: 否
- Since:
- JDK 25, opencode-base-functional V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
-
Method Details
-
apply
-
andThen
Compose with another function (execute this, then after) 与另一个函数组合(先执行本函数,再执行 after)- Type Parameters:
V- result type of after function - after 函数的结果类型- Parameters:
after- function to apply after this - 在本函数之后应用的函数- Returns:
- composed function - 组合后的函数
-