需求
当我们将复杂数据导出为Excel时,一般做法会是用工具类,将导出所需要的数据都装到List<Map<String, Object>>中,去处理
List<Map<String, Object>> psrObjMapList = Lists.newArrayList();
Map<String, Object> oObMaps = Maps.newHashMap();
oObMaps.put("a", name);
oObMaps.put("b", code);
psrObjMapList.add(oObMaps);
//对集合按“b”即code进行排序
List<Map<String, Object>> sortList = psrObjMapList.stream().sorted(Comparator.comparing(map -> (String) map.get("b"))).collect(Collectors.toList());