Set<String> set = new HashSet<>(persons.size()); persons.stream().filter(p -> set.add(p.getName())).collect(Collectors.toList());