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
The Most simple code you can write:
persons.stream().map(x-> x.getName()).distinct().collect(Collectors.toList());