Answers for "sort objects in descending order java"

0

java how to sort custom objects in descending orde

ArrayList<StudentInformation> infos = new ArrayList<StudentInformation>();
// fill array
Collections.sort(infos, (s1, s2) ->
    Integer.compare(s2.getBirthYear(), s1.getBirthYear()));
Posted by: Guest on October-03-2020
0

java how to sort custom objects in descending orde

ArrayList<StudentInformation> infos = new ArrayList<StudentInformation>();
// fill array
Collections.sort(infos, 
    Comparator.comparingInt(StudentInformation::getBirthYear).reversed());
Posted by: Guest on October-03-2020

Code answers related to "sort objects in descending order java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language