JAVA中Map集合遍历的方法
1.声明一个map:
Map map = new HashMap();
map.put(”sa”,”dd”);
str = ”dd”;
Map m = new HashMap(); for (Object o : map.keySet()) { map.get(o); }
Map map = new HashMap() ; Iterator it = map.entrySet().iterator() ; while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next() ; Object key = entry.getKey() ; Object value = entry.getValue() ; }