List list = new ArrayList<>();
list.add(1);
list.add(2);
//方法1:
Iterator it = list.iterator();
while (it.hasNext()) {
int str = (int) it.next();
System.out.print(str);
it.remove();
}
注意:
it .remove() 选择it进行remove 而不是 str.remove
标签:java,int,ConcurrentModificationException,list,remove,util,str
From: https://www.cnblogs.com/lwdwl/p/17095373.html