HashMap<String, String> map = new HashMap<>();
map.put("001", "赵");
map.put("002", "钱");
map.put("003", "孙");
map.put("004", "李");
for (String s : map.keySet()) {
System.out.println(map.get(s));
}
for (Map.Entry<String, String> entry : map.entrySet()) {
System.out.println( entry.getKey() + " " + entry.getValue());
}
标签:Map,遍历,Java,HashMap,map,put,entry
From: https://www.cnblogs.com/liudianer/p/17492824.html