Stream流 List<Map>排序

//添加静态方法
private static Integer sortMap(Map<String,Object> map){
return Integer.valueOf(map.get("evtId").toString());
}

//比较方法中添加类名(SendServiceImpl)::静态方法(sortMap)即可
List<Map<String,Object>> newMapList = mapList.stream().sorted(Comparator.comparing(SendServiceImpl::sortMap)).collect(Collectors.toList());;
 
原文地址:https://www.cnblogs.com/menglixiazhiweizhi/p/14003764.html