【工具类】JAVA8-用lamda表达式和增强版Comparator进行排序
1、单条件升序:
list.sort(Comparator.comparing(User::getId);
2、降序:
list.sort(Comparator.comparing(User::getId).reversed());
3、多条件升序排序:
list.sort(Comparator.comparing(User::getId).thenComparing(User::getName));
转载:http://blog.csdn.net/gao1440156051/article/details/71126194
天不酬勤不够勤,勤到极处自酬人。 ---持续学习