Java IdentityHashMap putAll()方法与示例
IdentityHashMap类putAll()方法 (IdentityHashMap Class putAll() method)
putAll() method is available in java.util package.
putAll()方法在java.util包中可用。
putAll() method is used to copy all of the entry (key-value pairs) that exists from the given map (m) and paste it into this IdentityHashMap.
putAll()方法用于复制给定映射(m)中存在的所有条目(键值对),并将其粘贴到此IdentityHashMap中。
putAll() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
putAll()方法是一种非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。
putAll() method may throw an exception at the time of copying key-value pairs.
在复制键值对时, putAll()方法可能会引发异常。
NullPointerException: This exception may throw when the given parameter is null exists.
NullPointerException :当给定参数为null时,可能引发此异常。
Syntax:
句法:
public void putAll(Map m);
Parameter(s):
参数:
Map m – represents the Map object that contains key-value pairs to be copied from.
Map m –表示Map对象,其中包含要从中复制的键/值对。
Return value:
返回值:
The return type of the method is void, it returns nothing.
该方法的返回类型为void ,不返回任何内容。
Example:
例:
// Java program to demonstrate the example
// of void putAll(Map m) method of IdentityHashMap
import java.util.*;
public class PutAllOfIdentityHashMap {public static void main(String[] args) {// Instantiates a IdentityHashMap object
Map < Integer, String > map = new IdentityHashMap < Integer, String > ();
Map < Integer, String > put_map = new IdentityHashMap < Integer, String > ();
// By using put() method is to add
// key-value pairs in a IdentityHashMap
map.put(10, "C");
map.put(20, "C++");
map.put(50, "JAVA");
map.put(40, "PHP");
map.put(30, "SFDC");
// Display IdentityHashMap
System.out.println("IdentityHashMap: " + map);
// By using putAll() method is to
// copy all of the elements of the given
// object and paste it in an another object
put_map.putAll(map);
// Display put_map IdentityHashMap
System.out.print("put_map.putAll(map): " + put_map);
}
}
Output
输出量
IdentityHashMap: {20=C++, 40=PHP, 50=JAVA, 30=SFDC, 10=C}
put_map.putAll(map): {20=C++, 40=PHP, 50=JAVA, 30=SFDC, 10=C}
翻译自: https://www.includehelp.com/java/identityhashmap-putall-method-with-example.aspx
Java IdentityHashMap putAll()方法与示例相关推荐
- java putall实现,Java JsonObject.putAll方法代码示例
import org.json.simple.JsonObject; //导入方法依赖的package包/类 static JSONObject unconfirmedTransaction(Tran ...
- Java IOUtils.copy方法代码示例(亲测)
本文整理汇总了Java中org.apache.commons.io.IOUtils.copy方法的典型用法代码示例.如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java I ...
- java hashmap putall_Java ConcurrentHashMap.putAll方法代码示例
import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类 /** * 生成更新Sql * @param entity * @ ...
- java user directory,Java ProcessBuilder directory()方法与示例
语法:public File directory (); public ProcessBuilder directory (File dir); ProcessBuilder类directory()方 ...
- Java序列化魔术方法及其示例使用
在上一篇文章中, 您需要了解有关Java序列化的所有知识 ,我们讨论了如何通过实现Java序列化来启用类的可序列化性. Serializable接口. 如果我们的类未实现Serializable接口, ...
- catalog java,Java Connection getCatalog()方法与示例
通常,目录是一个目录,其中包含有关数据集,文件或数据库的信息.而数据库目录中包含所有数据库,基本表,视图(虚拟表),同义词,值范围,索引,用户和用户组的列表. Connection接口的getCata ...
- filepermission java,Java FilePermission getActions()方法与示例
FilePermission类getActions()方法getActions()方法在java.io包中可用. getActions()方法用于检查此FilePermission和给定对象在路径名和 ...
- java方法参数Bundle,Java ResourceBundle keySet()方法及示例
ResourceBundle类keySet()方法keySet()方法在java.util包中可用. keySet()方法用于从此ResourceBundle及其超级捆绑包中获取所有现有键,以在Set ...
- java exec waitfor,Java Process waitFor()方法与示例
流程类waitFor()方法在java.lang包中提供了waitFor()方法. waitFor()方法用于使当前正在运行的线程在需要时等待,直到由该Process对象表示的进程完成其终止为止. 当 ...
最新文章
- opencv otsu二值化
- python os模块详细_Python文件系统功能--os模块详解
- 【转】最流行的编程语言JavaScript能做什么?
- Node.js 入门教程 (三):API-准备知识
- leetcode 328. Odd Even Linked List | 328. 奇偶链表(Java)
- js 的正则表达式 部分展示test()方法的验证功能
- 2017.10.17 Codechef MARCH14 GERALD07加强版 失败总结
- UI设计素材之按钮和选框,悠闲素材帮你轻松搞定设计。
- mybatis SqlMapConfig.xml properties
- 【UE4+Vive】学习笔记1
- linux shell 后台执行脚本的方法 脚本后台运行 后台运行程
- Wi-Fi 无线网二维码生成 API 接口
- 通过微信code获取微信openid
- 加法C语言基础程序,C语言菜鸟基础教程之加法
- Joomla 一个实例建站过程
- Multisim设置图纸大小的详细步骤
- WDN302国产化网络存储控制模块
- 山西师范计算机科学与技术能转什么专业,太原师范学院可以转专业吗 太原师范学院新生转专业政策...
- 【C语言】关机小游戏(最好的朋友转瞬即逝)
- 论文阅读笔记:Unsupervised Feature Learning via Non-Parametric Instance Discrimination
热门文章
- IIS-ShortName-Scanner使用
- c语言用整数 寻址,132-寻址运算符-C语言教程2020年 - 视频教程 - 北盟网校 - 专注原创教学第一站...
- linux字体如何删除不了,如何彻底替换Ubuntu下Chrome字体(清除楷体字)
- 云计算系统是大规模计算机系统吗,云计算的系统架构及技术探析
- java如何写安卓接口文档_android、java制作sdk以及自动生成文档
- 用了fastapi还需要nginx_nginx 与 fastdfs 的配置过程,已经越过了许多坑,我跪着进入了欢迎页面。。。...
- CSS 小结笔记之em
- 关于窗口的一些小脚本
- 解决Nginx: [error] open() Nginx.pid
- flask基础之jinja2模板-语法定义