对象多属性排序 发表于 2020-11-04 通过java的stream来排序 12345678910// name 是success的特殊处理list = list.stream().sorted(Comparator.comparing(Student::getHeight) .thenComparing(Student::getWeight) .thenComparing(Student::getNum)) .collect(java.util.stream.Collectors.toList());// 逆序排列java.util.Collections.reverse(list);for (MoreSort item : list) { System.out.println(item.getName());}