https://blog.csdn.net/qq_24877569/article/details/52187388
public static Map mapCombine(List list) {
Map map = new HashMap();
for (int i = 0; i< list.size();i++) {
Map newmap = (Map) list.get(i);
Iterator it = newmap.keySet().iterator();
while (it.hasNext()) {
Object key = it.next();
if (!map.containsKey(key)) {
List newList = new ArrayList();
newList.add(newmap.get(key));
map.put(key, newList);
} else {
((ArrayList) map.get(key)).add(newmap.get(key));
}
}
}
return map;
}
map.get(key)通过key值取到已有的map的val,值是一个list。
.add(newmap.get(key))合并list。