How to sort list of objects using multiple fields?
We can sort list using multiple fields with Comparator. Here we are going to see two ways to do that. Let’s say we have a Student class as below. And a list of Students. private List<Student> getStudentList() { return Arrays.asList(new Student(1, “Bindu”, “IT”), new Student(2, “Sam”, “CS”), new Student(3, “David”, “IT”), new Student(4, “Anjali”, “CS”)); …
How to sort list of objects using multiple fields? Read More »