Skip to content

Instantly share code, notes, and snippets.

@ChinaXing
Created August 12, 2014 05:10
Show Gist options
  • Save ChinaXing/be4f0f316bacb5656717 to your computer and use it in GitHub Desktop.
Save ChinaXing/be4f0f316bacb5656717 to your computer and use it in GitHub Desktop.
for 循环迭代对并发修改是否会抛出异常
Map<String,Object> map = new HashMap<String, Object>();
// Thread 1
for(Entry<String,Object> entry : map.entrySet()){
// print entry content;
}
// Thread 2
map.put("Key1",new Object());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment