3
Map<String,String> map1= new HashMap<String, String>(){{
            put("no1","123"); put("no2","5434"); put("no5","234");}};        

Map<String,String> map2 = new HashMap<String, String>(){{
            put("no1","523"); put("no2","234"); put("no3","234");}};


Multimap<String, String> totalMap = ArrayListMultimap.create();

totalMap.putAll()仅支持 Multimap。如何将所有 map1 和 map2 放到 multimap 中?

4

1 回答 1

6

用于查看您Multimaps.forMap(Map<K,V>)Multimap地图,然后将其添加到 中totalMap,例如:

totalMap.putAll(Multimaps.forMap(map1));
于 2013-07-01T09:58:36.550 回答