🏎️8. sort by mass
List<Person> sortMassPerson = characters.stream()
.sorted(Comparator.comparingInt(Person::getMass).reversed())
.collect(Collectors.toList());
sortMassPerson.forEach(Person::info);
Last updated
Was this helpful?