In Java 8 how can I filter a collection using the Stream API by checking the distinctness of a property of each object?
Stream
For example I have a list of
Distinct objects list can be found using:
List distinctPersons = persons.stream() .collect(Collectors.collectingAndThen( Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Person:: getName))), ArrayList::new));