BiFunction.java官方文档翻译

package java.util.function;

import java.util.Objects;

/**
* 表示接收两个参数返回一个结果的函数。
* 这是 {@link Function}的特殊化
*
* <p>这是一个 <a href="package-summary.html">函数式接口</a>
* 它的函数式方法是 {@link #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
*
* @see Function
* @since 1.8
*/
@FunctionalInterface
public interface BiFunction<T, U, R> {

/**
* 将给定的参数应用这个函数
*
* @param t the first function argument
* @param u the second function argument
* @return the function result
*/
R apply(T t, U u);

/**
* 返回一个组合函数,它首先将该函数应用于它的输入,然后将 {@code after}
* 函数应用于结果。如果任一函数的评估抛出异常,
* 则将其传递给组合函数的调用方 。
*
* @param <V> 函数的输出类型 {@code after} ,以及组合函数的类型。
* @param after 应用该函数后的函数
* @return 一个组合的函数,首先应用这个函数,然后应用{@code after} 函数。
* @throws NullPointerException if after is 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));
}
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值