如何在 Java 中使用 lambda 表达式实现 ToIntBiFunction ?
ToIntBiFunction
语法
@FunctionalInterface interface ToIntBiFunction{ int applyAsInt(T t, U u); }
示例
import java.util.function.ToIntBiFunction;
public class ToIntBiFunctionTest {
public static void main(String args[]) {
ToIntBiFunction test = (t, u) -> t * u;
System.out.println("t和u的乘积为: " + test.applyAsInt(10, 7));
System.out.println("t和u的乘积为: " + test.applyAsInt(8, 15));
}
} 输出结果t和u的乘积为: 70 t和u的乘积为: 120
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短