JAVA8-用lamda表达式和增强版Comparator进行排序
http://blog.csdn.net/gao1440156051/article/details/71126194
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));
还没有评论,来说两句吧...