Code: Select all
HashMap map1;
HashMap map2; ...
Und ich möchte dies erreichen, ohne die Daten zu verlieren.
Beispiel:
Code: Select all
map1 has entries: {, , }
< /code>
map2 has entries: {, , }
< /code>
mergedMap: {, , }
< /code>
I have tried this:
ArrayList listHashMap = new ArrayList();
HashMap mergedMap = new HashMap();
for(HashMap map: listHashMap) {
mergedMap.putAll(map);
}
< /code>
But I've understood that the values mapped to the same key would be replaced (put