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.

@FunctionalInterface public interface TriFunction<T1,T2,T3,R>
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

    Modifier and Type
    Method
    Description
    default <V> TriFunction<T1,T2,T3,V>
    andThen(Function<? super R, ? extends V> after)
    Compose with another function (execute this, then after) 与另一个函数组合(先执行本函数,再执行 after)
    apply(T1 t1, T2 t2, T3 t3)
    Apply function to three arguments 应用函数到三个参数
  • Method Details

    • apply

      R apply(T1 t1, T2 t2, T3 t3)
      Apply function to three arguments 应用函数到三个参数
      Parameters:
      t1 - first input - 第一个输入
      t2 - second input - 第二个输入
      t3 - third input - 第三个输入
      Returns:
      result - 结果
    • andThen

      default <V> TriFunction<T1,T2,T3,V> andThen(Function<? super R, ? extends V> after)
      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 - 组合后的函数