List根据对象的两个字段进行排序,并且有一个倒序

用java8 的lambda 表达式

list.sort(Comparator.comparing(Live::getId)
  .thenComparing(Live::getAppId, Comparator.reverseOrder()));

猜你喜欢

转载自www.cnblogs.com/acm-bingzi/p/list_compare.html