📅  最后修改于: 2022-03-11 14:58:28.333000             🧑  作者: Mango
ArrayList employees = getUnsortedEmployeeList();
Comparator compareById = (Employee o1, Employee o2) -> o1.getId().compareTo( o2.getId() );
Collections.sort(employees, compareById);
Collections.sort(employees, compareById.reversed());