Java 遍历Map所有元素的代码
//JDK1.5
Map m = new HashMap();
for (Object o : map.keySet()){
map.get(o);
}
JDK1.4
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() ;
}
作者:吴旭晓 | 来源:个人博客 | 点击量:796 | 发布时间:2013/6/24
最新留言 |
返回上一页 |
返回首页