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