您的位置:首页 > 其它

【笔记】遍历Map的方法

2012-07-29 14:21 162 查看
mapA为HashMap<String, String>

Set entrySet = mapA.entrySet();
int i=0;
for(Iterator iter = entrySet.iterator(); iter.next);
{
i++;
Map.Entry entry = iter.next();
System.out.println("the "+i+"th key is"entry.getKey());
System.out.println("the "+i+"th value is"entry.getValue());
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iterator