//升序排序
List studentsSortAsce = studentList.stream().sorted(Comparator.comparing(Student::getCreateTime)).collect(Collectors.toList());
//降序排序
List studentsSortDesc = studentList.stream().sorted(Comparator.comparing(Student::getCreateTime).reversed()).collect(Collectors.toList());
stream流给对象集合排序
最新推荐文章于 2024-04-07 16:40:43 发布