Extending Stuart Marks's answer, this can be done in a shorter way and without a concurrent map (if you don't need parallel streams):
public static Predicate distinctByKey(Function super T, ?> keyExtractor) {
final Set
Then call:
persons.stream().filter(distinctByKey(p -> p.getName());