java8对list进行多字段去重(亲测可用)

List<CatTest> catList = Lists.newArrayList();
catList.stream()
.collect(
Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(cat -> cat.getCarHobby() + cat.getCatName()))),
ArrayList::new
)
);
划船不用桨、杨帆不等风、一生全靠浪
原文地址:https://www.cnblogs.com/pypua/p/15107161.html