java遍历Map

//方法一  
Set<String> keys = map.keySet();   
for (String key:keys) {  
   System.out.println(key+","+map.get(key));  
}  

//方法二  
Set<Map.Entry<String, String>> entryseSet=map.entrySet();  
for (Map.Entry<String, String> entry:entryseSet) {  
System.out.println(entry.getKey()+","+entry.getValue());  
}  

  

posted @ 2017-04-12 10:52  kedarui  阅读(193)  评论(0编辑  收藏  举报