public static Map mapMerge(List<Map> list) {
Map<Object, List> map = new HashMap<>();
for (Map m : list) {
Iterator<Object> it = m.keySet().iterator();
while (it.hasNext()) {
Object key = it.next();
if (!map.containsKey(key)) {
List newList = new ArrayList<>();
newList.add(m.get(key));
map.put(key, newList);
} else {
map.get(key).add(m.get(key));
}
}
}
return map;
}
版权声明:本文为massddss原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。