public static void main(String[] args){
List<SpecimenMessageCustomerParamsVm> historyHeaderStatisticsVOs=new ArrayList();
SpecimenMessageCustomerParamsVm obj1=new SpecimenMessageCustomerParamsVm();
obj1.setProjectPrincipal(2);
obj1.setJsonList("A");
SpecimenMessageCustomerParamsVm obj2=new SpecimenMessageCustomerParamsVm();
obj2.setProjectPrincipal(3);
obj2.setJsonList("c");
SpecimenMessageCustomerParamsVm obj3=new SpecimenMessageCustomerParamsVm();
obj3.setProjectPrincipal(1);
obj3.setJsonList("b");
historyHeaderStatisticsVOs.add(obj1);
historyHeaderStatisticsVOs.add(obj2);
historyHeaderStatisticsVOs.add(obj3);
/* Map<String, List<SpecimenMessageCustomerParamsVm>> collectMap = historyHeaderStatisticsVOs.stream()
.sorted(Comparator.comparing(iteam -> iteam.getProjectPrincipal()))
.collect(Collectors.groupingBy(iteam -> iteam.getJsonList(), TreeMap::new, Collectors.toList()));*/
// List<SpecimenMessageCustomerParamsVm> sort = sort(historyHeaderStatisticsVOs);
historyHeaderStatisticsVOs.sort(Comparator.comparing(SpecimenMessageCustomerParamsVm::getJsonList).reversed().thenComparing(SpecimenMessageCustomerParamsVm::getJsonList));
/* System.out.println(sort);*/
System.out.println(historyHeaderStatisticsVOs);
historyHeaderStatisticsVOs.sort(Comparator.comparing(SpecimenMessageCustomerParamsVm::getJsonList).thenComparing(SpecimenMessageCustomerParamsVm::getJsonList));
System.out.println(historyHeaderStatisticsVOs);
//5.根据多个字段,进行排序
//倒序:List.sort(Comparator.comparing(Entity::getState).reversed().thenComparing(Entity::getName));
// 升序:List.sort(Comparator.comparing(Entity::getState).thenComparing(Entity::getName));
}