如果你现在正在使用Java8,那一定要看看在Java8中,对map操作遍历可以采用第4种方式哦。...>();
map.put(1, "a");
map.put(3, "c");
map.put(4, "d");
map.put(2, "b");... map = new HashMap();
map.put(1, "a");
map.put(3, "c");
map.put(4, "d"...value);
}
}
输出结果:
Key = 1 Value = aKey = 2 Value = bKey = 3 Value = cKey = 4 Value = d
四:强烈推荐通过Java8...>();
map.put(1, "a");
map.put(3, "c");
map.put(4, "d");
map.put(2, "b");
map.forEach