Map.putAll()用法
来源:互联网 发布:热点图软件 编辑:程序博客网 时间:2024/09/21 08:55
import java.util.HashMap;
public class Map_putAllTest {
public static void main(String[] args){
//两个map具有不同的key
HashMap map1=new HashMap();
map1.put("1", "A");
HashMap map2 = new HashMap();
map2.put("2", "B");
map2.put("3", "C");
map1.putAll(map2);
System.out.println(map1);
//两个map具有重复的key
HashMap map3=new HashMap();
map3.put("1", "A");
HashMap map4 = new HashMap();
map4.put("1", "B");
map4.put("3", "C");
map3.putAll(map4);
System.out.println(map3);
}
}
/* 输出结果:
* {3=C, 2=B, 1=A}
* {3=C, 1=B}
* 结论:putAll可以合并两个MAP,只不过如果有相同的key那么用后面的覆盖前面的
* */
- Map.putAll()用法
- Map.putAll()用法
- Map.putAll()用法
- Map.putAll()用法
- Map.putAll()用法
- Map.putAll()的用法
- Map.putall()方法
- Map.putAll() 使用方法 简单易懂
- java中关于Map的三种遍历方法机putAll的用法详解
- Map的赋值和putAll的区别
- Map集合的putAll()方法的使用。
- Map.putAll(Map<? extends String, ? extends Object> m)方法
- Map.putAll方法——追加另一个Map对象到当前Map集合
- HashMap.putAll
- map用法
- map用法
- map用法
- Map用法
- XNA入门教程----(三) 简单的动画
- Ubuntu自动定时关机的方法
- Eclipse 常用快捷键(转)
- INTEGER PRIMARY KEY简介
- 关于“reset high speed USB device using ehci_hcd and address 2”
- Map.putAll()用法
- 【水晶玻璃鞋 5】更改用IE浏览器打开FTP时的默认显示方式
- 中断寄存器详解
- 简要介绍XML解析器DOM,SAX的区别和特点
- 查看当前端口对应的进程名字
- 查找指定字符串在数组中是否存在
- Servlet中listener和filter的总结
- Ubuntu 10.04 LTS i386 desktop 字符启动设置
- 任务及方向