custom comparetor java code example
Example: collections.sort custom comparator
ArrayList employees = getUnsortedEmployeeList();
Comparator compareById = (Employee o1, Employee o2) -> o1.getId().compareTo( o2.getId() );
Collections.sort(employees, compareById);
Collections.sort(employees, compareById.reversed());