removing an item from a list in for each loop causing java.util.ConcurrentModificationException
<p>I had a foreach loop that iterates through an arraylist.</p>

<p>In the body of the for loop I have an if condition which removes the current item from the list.</p>

<pre><code>for (item in mylist){
    if(some condition is met)
        mylist.remove(mylist.indexOf(item))
}
</code></pre>

<p>But this is causing a <code>java.util.ConcurrentModificationException</code> to be thrown, is it illegal to do this in groovy, and if so how can i get past this?</p>