private static void method(Function<String, Integer> one, Function<Integer, Integer> two, String str) {
Function<String, Integer> stringf = one.andThen(two);
Integer apply = stringf.apply("天龙八部");
System.out.println(apply);
//第一 最终的泛型是最后的两种结果状态.中间的统统省略 也就是传入的参数类型是 String 最后返回的是Integer
//第二 one.andThen(two) 返回的是two 的是现实体. 也就是方法体是 two.applty(one.apply)
//每一个function对象对apply方法的调用其实都意味着一个新的对象的产生
//尽管方法体可一完全一致
//one.andthen(two).apply(o);
// 第一 返回一个用有方法体的继承Function函数的two对象;
// 第二 对象重写了apply方法 apply方法中调用了one.apply(o) 方法
//lanmda表达式都是接口对抽象方法的调用
//在写入参数的时候 直接产生逻辑思维对象和方法的过程
//每个加强的函数都是对前面函数对象的一种重新调用操作
}
Lamda表达式的思考
猜你喜欢
转载自blog.csdn.net/qq_34627002/article/details/88909039
今日推荐
周排行