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());
}

你可能感兴趣的:(map)