遍历List,根据子项的某个属性分组

        List list = operationsOfficeService.getOperationalProgress(param);

        Map<String, List> map = new HashMap<>(16);
        for(int i=0; i<list.size(); i++) {
            Map opMap = (Map) list.get(i);
            //map中存在此id,将数据存放当前key的map中
            if (map.containsKey(opMap.get("ymdDate").toString())) {
                map.get(opMap.get("ymdDate").toString()).add(opMap);
            } else {//map中不存在,新建key,用来存放数据
                List tmpList = new ArrayList<>();
                tmpList.add(opMap);
                map.put(opMap.get("ymdDate").toString(), tmpList);
            }
        }
        return map;
原文地址:https://www.cnblogs.com/linhongwenBlog/p/11738976.html