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
Similar approach which Saeed Zarinfam used but more Java 8 style:)
persons.collect(Collectors.groupingBy(p -> p.getName())).values().stream() .map(plans -> plans.stream().findFirst().get()) .collect(toList());