首页 > TAG信息列表 > getFraction

Java8 List.stream().sorted 根据对象元素排序

//返回 对象集合以UsergetAge升序排序:年龄 --默认升序 userList.stream().sorted(Comparator.comparing(User::getAge)); //返回 对象集合以UsergetAge降序排序 ===这里写在前面 和写在后面要看清楚,弄明白 userList.stream().sorted(Comparator.comparing(User::getAge).rev