Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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()));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #sort #custom #objects #descending #orde
ADD COMMENT
Topic
Name
4+6 =