Java8集合排序
List<JudicialUpdateItem> judicialUpdateItems = resultList.stream()
.sorted(Comparator.comparing(JudicialUpdateItem::getDate,
Comparator.nullsLast(Date::compareTo))).collect(Collectors.toList());
comparing: 设置要排序的字段
nullsLast:字段为空的排到最后
reversed:倒叙
示例:Comparator.comparing(JudicialUpdateItem::getDate).reversed()
按多列排序(group by A,B)
list.stream().sorted(Comparator.comparing(类::属性一).thenComparing(类::属性二));
忽略首字母大小写
students.sort(Comparator.comparing(Student::getName, String.CASE_INSENSITIVE_ORDER));