我有一个列表ListIterator<PointF>
作为类字段。我填写方法grow()
。当我尝试从这个列表中使用迭代器时,我得到ConcurrentModificationException
。Java:无法更改迭代器列表
ListIterator<ListIterator<PointF>> i = mPoints.listIterator();
while (i.hasNext()) {
ListIterator<PointF> j = i.next();
if (j.hasNext())
PointF tmp = j.next(); // Exception here
}
我不知道为什么会发生这种代码会导致exeption以任何方法除了grow()
请发布一个简短但完整的程序来演示问题。 – 2010-11-13 13:23:04
@Jon Skeet问题解决了,我在获得迭代器后修改了我的列表'mPoints'。 – Heheid 2010-11-13 13:42:26