lambda表达式的体会
作者:互联网
在学习java基础使偶尔使用的lambda表达式的简洁性
原:
Comparator<Employee> com = new Comparator<Employee>() {
@Override
public int compare(Employee o1, Employee o2) {
return -o1.getName().compareTo(o2.getName());
}
};
用完lambda:
Comparator<Employee> com = (Employee ee1,Employee ee2)-> -ee1.getName().compareTo(ee2.getName());
标签:体会,Comparator,getName,ee1,ee2,Employee,表达式,lambda 来源: https://blog.csdn.net/m0_57040249/article/details/122754767