Every time I try to call ArrayList.remove() on an element while in a for each loop, Java throws a ConcurrentModificationException. I need to remove an element in a for loop because in there is where I look through the objects to find objects which meet the criteria for removal.
Name:
Anonymous2012-01-18 14:11
for each in java is absolute shit, stop using it.
Instead consider a proper Iterator or a basic for loop.
/* THE LOGICAL WAY */
Object o;
int i;
for(i=0;i<anus.size();++i){
/* BULLSHIT */
if(I_SHOULD_REMOVE_THIS_INDEX){
o = anus.remove(i);
--i;
/* BULLSHIT WITH O */
}
/* BULLSHIT */
}