标签:
常用iterate 方法
1 Map<Integer, String> m = new HashMap<Integer, String>(); 2 for(Map.Entry<Integer, String> entry : m.entrySet()){ 3 System.out.println("Key: " + entry.getKey() + ", Value: " + entry.getValue()); 4 } 5 6 7 Iterator<Map.Entry<Integer, String>> iterator = m.entrySet().iterator(); 8 while(iterator.hasNext()){ 9 Map.Entry entry = iterator.next(); 10 System.out.println("Key: " + entry.getKey() + ", Value: " + entry.getValue()); 11 }
标签:
原文地址:http://www.cnblogs.com/Dylan-Java-NYC/p/5164888.html