标签:ping ada div pre hashmap group span stream shm
List<Map<String, Object>> foreList = forecastDataDao.getcityforeresults(param); Map<String,List<Map<String, Object>>> timegroupby=foreList.stream().collect(groupingBy(p->p.get("citycode").toString())); Map<String,Map<String,List<Map<String, Object>>>> ret=new HashMap<>(); if(timegroupby!=null){ for(String time:timegroupby.keySet()){ Map<String,List<Map<String, Object>>> citygroup=null; citygroup=timegroupby.get(time).stream().collect(groupingBy(p->DateUtil.dateToStr((Date)p.get("datatime"),"yyyyMMdd"))); if(citygroup!=null){ ret.put(time,citygroup); } } } return JSONObject.toJSONString(ret);
java stream数据分组 stream().collect(groupingBy
标签:ping ada div pre hashmap group span stream shm
原文地址:https://www.cnblogs.com/tiandi/p/12704557.html