java遍历map的一种方法
程序员文章站
2024-02-14 22:54:58
...
Set<Map> set = new HashSet<Map>();
for(int i=0;i<6;i++){
Map<String, Integer> map = new HashMap<String, Integer>();
map.put("1", 1);
set.add(map);
}
for(Map<String, Integer> m:set){
Set<String> s=m.keySet();
for (Iterator it = s.iterator(); it.hasNext();) {
String ss = (String) it.next();
System.out.println(m.get(ss));
}
}