checkForComodification

1
2
3
4
5
6
7
8
9
10
11
12
//执行这段代码是会抛出异常 ConcurrentModificationException
for (String str : list) {
if ("remove".equals(str)) {
list.remove(str);
}
}

//具体位置
final void checkForComodification() {
if (modCount != expectedModCount)
throw new ConcurrentModificationException();
}
阅读更多