📜  迭代 hashmap java 代码示例

📅  最后修改于: 2022-03-11 14:52:17.488000             🧑  作者: Mango

代码示例6
public static void printMap(Map mp) {
    Iterator it = mp.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry)it.next();
        System.out.println(pair.getKey() + " = " + pair.getValue());
        it.remove(); // avoids a ConcurrentModificationException
    }
}