Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to sort a collection using stream

List result = list.stream().sorted((o1, o2)->o1.getItem().getValue().
                                   compareTo(o2.getItem().getValue())).
                                   collect(Collectors.toList());
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #collection #stream
ADD COMMENT
Topic
Name
4+2 =