Java 遍历Map

1. 迭代器遍历

2. for-each遍历

for(Map.Entry<String,Integer> cur:mp.entrySet()){
    System.out.println(cur.getKey()+" "+cur.getValue());
}
原文地址:https://www.cnblogs.com/Kinghao0319/p/14978330.html