Программисты JAVA общаются здесь
-
Anonymous
JAVA 8 отличается по ключу
Сообщение
Anonymous »
Код: Выделить всё
public List getFilteredList(List l1) {
return l1
.stream()
.filter(distinctByKey(XYZ::getName))
.filter(distinctByKey(XYZ::getPrice))
.collect(Collectors.toList());
}
private static Predicate distinctByKey(Function
Подробнее здесь: [url]https://stackoverflow.com/questions/72571561/java-8-distinctbykey[/url]
1728642424
Anonymous
[code]public List getFilteredList(List l1) {
return l1
.stream()
.filter(distinctByKey(XYZ::getName))
.filter(distinctByKey(XYZ::getPrice))
.collect(Collectors.toList());
}
private static Predicate distinctByKey(Function
Подробнее здесь: [url]https://stackoverflow.com/questions/72571561/java-8-distinctbykey[/url]