Java中List通过Lambda实现排序

目录

1.正常排序,1,2,3

2.倒序 3,2,1


1.正常排序,1,2,3

        list=list.stream().sorted(Comparator.comparing(VipCardVo::getVipCardType)).collect(Collectors.toList());

2.倒序 3,2,1

        list=list.stream().sorted(Comparator.comparing(VipCardVo::getVipCardType).reversed()).collect(Collectors.toList());
原文地址:https://www.cnblogs.com/yelanggu/p/13457109.html