I was trying to filter a list based on multiple conditions, sorting.
class Student{
private int Age;
private String className;
privat
If you need a grouping only sorted, it is quite simple:
Map> collect = students.stream() // stream capabilities
.sorted(Comparator.comparingInt(Student::getAge).reversed()) // sort by age, descending
.collect(Collectors.groupingBy(Student::getName)); // group by name.
Output in collect: