【发布时间】:2011-07-22 16:23:03
【问题描述】:
通常我们写这个是为了从映射中获取键和值。
Map m=new HashMap();
Set s=map.entrySet();
Iterator i=s.iterator()
while(s.hasNext()){
Map.Entry m= (map.Entry) s.next();
System.out.println(""+m.getKey()+""+ m.getValue());
}
为什么我们使用集合进行迭代为什么不直接映射?
【问题讨论】:
标签: java dictionary collections iterator