lambda(匿名函数)[参数-箭头-主题]
案例
Comparator<Apple> sortApples = new Comparator<Apple>(){
@Override
public int compare(Apple apple, Apple t1) {
return 0;
}
};
//java8
Comparator<Apple> jave8sortApples = (Apple a1,Apple a2)->a1.getHeavay().compareTo(a2.getHeavay());
使用地方
函数式接口
环绕执行模式
191页