strean collect order by a field object code example
Example 1: java stream order by property
List<String> sorted = original.stream().sorted((o1,o2)-> o1.compareTo(o2)).collect(Collectors.toList());
Example 2: java stream sort
List<String> sorted = original.stream().sorted().collect(Collectors.toList());