Код: Выделить всё
Set seen = ConcurrentHashMap.newKeySet();
List names = people.stream()
.map(Person::getName)
.filter(seen::add)
.collect(Collectors.toList());
Подробнее здесь: https://stackoverflow.com/questions/780 ... items-in-j
Код: Выделить всё
Set seen = ConcurrentHashMap.newKeySet();
List names = people.stream()
.map(Person::getName)
.filter(seen::add)
.collect(Collectors.toList());