// HashMap新建
HashMap<String, Object> map = new HashMap<String, Object>();
// HashMap赋值
map.put("id", 12);
map.put("name", "张十三");
// HashMap遍历
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
// HashMap取值
map.get("id").toString();
HashMap操作
最新推荐文章于 2024-02-01 17:16:34 发布