ConcurrentModificationException when iterating through an ArrayList <Integer>
<p>I'm trying to iterate through a Integer ArrayList and getting the value at each element, but I'm getting an error at the int value = ....</p>

<p>Not sure whats happening. Please advise. </p>

<pre><code>Iterator&lt;Integer&gt; listItr = executeList.iterator(); // iterator for the execute list 
    while (listItr.hasNext()) { // iterate through list and do work!
        int robIndex = listItr.next();
        int timer = fakeRob.exeCountDown(robIndex); // decrement first then return timer
        if (timer == 0) {// check if instr finished execution
            System.out.println("timer expired. fire");
            executeList.remove(executeList.indexOf(robIndex)); // 1. remove instr from exeList
            transitState(robIndex, EX, WB); // 2. transit from EX state to WB state
            int tag = fakeRob.getTag(robIndex); // get producer tag
            regFile.setRdy(tag); // 3a. set register file ready flag for this tag
            fakeRob.wakeUp(tag); // 3b. wake up instructions with this tag
        }
    }
</code></pre>

<p>Error: </p>

<pre><code>java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at sim.execute(sim.java:180)
at sim.&lt;init&gt;(sim.java:71)
at sim.main(sim.java:270
</code></pre>

<p>Thanks,</p>

<p>Hank</p>
