1、多字段(对象属性)去重 list = list.stream().collect(Collectors.collectingAndThen( Collectors.toCollection( () -> new TreeSet<>( Comparator.comparing( smList -> smList.getIp() + ";" + smList.getModule() + ";" + smList.getStatus() + ";" + smList.getExceptionTime() + ";" + smList.getCollectCount() + ";" + smList.getCollectTime() ) ) ), ArrayList::new)); list = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection( () -> new TreeSet<>(Comparator.comparing(SurvivalMonitor::getIp).thenComparing(SurvivalMonitor::getModule)) ), ArrayList<SurvivalMonitor>::new)); 2、排序 :年级(倒序)、年龄(顺序)、身高(倒序) list.stream().sorted(Comparator.comparing(User::getClass,Comparator.reverseOrder()) .thenComparing(User::getAge) .thenComparing(User::getHeight,Comparator.reverseOrder()) ).collect(Collectors.toList());