Created
January 3, 2018 04:59
-
-
Save sreelallalu/0c9507e8d0c9cfd32c851d3db0f6f102 to your computer and use it in GitHub Desktop.
Collection sorting List
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<Employee> getEmployeeListSortedByName() { | |
final List<Employee> employeeList = getEmployeeList(); | |
Collections.sort(employeeList, new Comparator<Employee>() { | |
@Override | |
public int compare(Employee a1, Employee a2) { | |
return a1.getName().compareTo(a2.getName()); | |
} | |
}); | |
return employeeList; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment