Java List根据某一字段值进行排序

  • A+
所属分类:Java 技术杂谈
List<StatisticDetail> dayRes = new ArrayList<>();
#........
List<StatisticDetail> dayResCollect = dayRes.stream()
.sorted(Comparator.comparing(StatisticDetail::getNums, Comparator.reverseOrder()))
.collect(Collectors.toList());

 

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: