这是我的代码:
// eventList is a LinkedList public void run() { Iterator<Event> it = eventList.iterator(); int size = eventList.size(); while(size > 0) { while(it.hasNext()) { Event e = it.next(); //flaged line if(e.ready()) { System.out.println(e); e.action(); eventList.remove(e); --size; } } } }
错误的java.util.ConcurrentModificationException在标记的行中抛出(Event e = it.next();).你是否在我的代码中看到一个错误,这个错误明显是抛出异常的原因?