1 //entrySet()
2 for (Entry<String, String> entry : map.entrySet()) {
3 String key = entry.getKey();
4 String value = entry.getValue();
5 System.out.println(key + " : " + value);
6 }
7
8 //上下对比
9
10 //keySet()
11 for (String key : map.keySet()) {
12 String value = map.get(key);
13 System.out.println(key + " : " + value);
14 }
Map遍历效率 : entrySet > keySet
原文:http://www.cnblogs.com/bilaisheng/p/4976074.html