首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

地图 转换Set遍历

2012-12-28 
map 转换Set遍历Map mapnew HashMap()map.put(key1, value1)map.put(key2, value2)map.put(k

map 转换Set遍历
Map map=new HashMap();
map.put("key1", "value1");
map.put("key2", "value2");
map.put("key3", "value3");

Iterator it1=map.entrySet().iterator();
while(it1.hasNext())
{
    Map.Entry entry=(Map.Entry)it1.next();
    System.out.println("key="+entry.getKey());
    System.out.println("value="+entry.getValue());
}

热点排行