【发布时间】:2016-11-23 04:57:55
【问题描述】:
这是我对 ConcurrentHashMap 的测试
@Test
public void testIt2() {
Map<String, String> map = new ConcurrentHashMap<String, String>();
map.put("2", "2");
map.put("1", "1");
for (Entry<String, String> entry : map.entrySet()) {
map.clear();
System.out.println(entry.getKey());
}
}
输出是:
1
2
为什么?
【问题讨论】:
标签: java dictionary concurrenthashmap