Answers for "how to sort a collection using stream"

0

how to sort a collection using stream

List result = list.stream().sorted((o1, o2)->o1.getItem().getValue().
                                   compareTo(o2.getItem().getValue())).
                                   collect(Collectors.toList());
Posted by: Guest on April-04-2022
0

how to sort a collection using stream

List<String> sortedList = list.stream().sorted().collect(Collectors.toList());
Posted by: Guest on April-04-2022

Code answers related to "how to sort a collection using stream"

Browse Popular Code Answers by Language