本质上还是使用treeset对实体类集合进行去重判断
peoples = peoples.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(
() -> new TreeSet<>(
Comparator.comparing(People::getName),
ArrayList::new
)
)
)
)
本质上还是使用treeset对实体类集合进行去重判断
peoples = peoples.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(
() -> new TreeSet<>(
Comparator.comparing(People::getName),
ArrayList::new
)
)
)
)