list = list.stream().sorted(Comparator.comparing(实体::排序字段).reversed()).collect(Collectors.toList());
案例
List<ServiceRecord> recorderList = new ArrayList<>();
for (ServiceOrder order : orderList){
List orderLists = this.iServiceRecordService.list(new QueryWrapper<ServiceRecord>().lambda().eq(ServiceRecord::getOrderId, order.id));
for(Object record : orderLists){
recorderList.add((ServiceRecord) record);
}
}
recorderList = recorderList.stream().sorted(Comparator.comparing(ServiceRecord::getCreateTime).reversed()).collect(Collectors.toList());
另一种方法(整形为例)
resultList.sort(Comparator.comparingInt(ServiceInfoItemResultAudit::getSortNum));