Java 遍历Map

1. 迭代器遍历

2. for-each遍历

for(Map.Entry<String,Integer> cur:mp.entrySet()){
    System.out.println(cur.getKey()+" "+cur.getValue());
}

 

posted @ 2021-07-06 18:32  Kinghao0319  阅读(23)  评论(0编辑  收藏  举报