BiFunction翻译

水平有限,欢迎指正

/**
 * Represents a function that accepts two arguments and produces a result.
 * This is the two-arity specialization of Function.
 *
 * This is a functional interface whose functional method is apply(Object,Object)
 *
 * 代表一个接受两个参数,输出一个结果的函数
 * 这个是二元的特殊Function
 *
 * 这个是个函数式接口,函数方法是apply(Object,Object)
 *
 * @Param<T> the type of the first argument to the function 这个函数第一个参数的类型
 * @Param<U> the type of the second argument to the function 这个函数第二个参数的类型
 * @Param<R> the type of the result of the function 这个函数结果的类型
 */
public interface BiFunction<T,U,R> {

    /**
     * Applies this function to the given arguments.
     * 将函数引用于给定的参数
     *
     * @param t the first function argument 第一个函数参数
     * @param u the second function argument 第二个函数参数
     * @return the function result 函数结果
     */
    R apply(T t,U u);

    /**
     * Return a composed function that first applies this function to its input,and then applies
     * the after function to the result.
     * If evaluation of either function throws an exception,it is relayed to the caller of the composed
     * function.
     *
     * 返回一个组合函数,这个应用自身函数到入参,然后应用after函数到这个函数的结果。
     *
     * 如果任意函数求值抛出异常,则这个异常则会转发给这个组合函数的调用者。
     * @param after the function to apply after this function is applied 在本地函数应用后应用的函数
     * @param <V> the type of output of the after function,and of the composed function
     *           这个after函数和组合函数的输出
     * @return NullPinterException if after is null 如果after函数为null
     */
    default <V> BiFunction<T,U,V> andThen(Function<? super R,?extends V> after) {
        Objects.requireNonNull(after);
        return (T t, U u) -> after.apply(apply(t, u));
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值