1. 正序: 1,2,3,4,5
list.stream().sorted(Comparator.comparing(Dto::getStateCode)).collect(Collectors.toList());
2.降序: 5,4,3,2,1
.reversed()
list.stream().sorted(Comparator.comparing(Dto::getStateCode).reversed()).collect(Collectors.toList());
版权声明:本文为weixin_44722978原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。