map.putAll()用法
public static void main(String[] args) {
Map map= new HashMap();
map.put(1, "A");
Map map1 =new HashMap();
map1.put(2, "B");
map1.put(3, "C");
map.putAll(map1);
System.out.println(map);
Map map2= new HashMap();
map2.put(2, "c");
map.putAll(map2);
System.out.println(map);
}
*/ 输出
* {1=A, 2=B, 3=C}
* {1=A, 2=c, 3=C}
* 结论:putAll可以合并两个MAP,只不过如果有相同的key那么用后面的覆盖前面的
***