第一种有实体多字段排序,加reversed()为倒序,不加为顺序
listAll = listAll.stream().sorted(Comparator.comparing(UserStatistics::getType).reversed()
.thenComparing(UserStatistics::getName).reversed()).collect(Collectors.toList());
第二种没实体,控制o1和o2实现倒序和顺序排序
List<Map> listSort= alarmid.stream() .sorted((o1, o2) -> o2.get("startTime").toString()
.compareTo(o1.get("startTime").toString())) .collect(Collectors.toList());