在学习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 = (ee1, ee2) -> -ee1.getName().compareTo(ee2.getName());