CodeSpells-Old icon indicating copy to clipboard operation
CodeSpells-Old copied to clipboard

EnchantedList.remove is broken

Open Xavion3 opened this issue 11 years ago • 0 comments

Causes java.util.ConcurrentModificationException when used. It's caused because it removes from eList while looping through eList. Example fix here

int index = 0;
for (Enchanted e : eList) {
    if ((e.getId()).equals(ench.getId())) {
        break;
    }
    index++;
}
eList.remove(index);
Log.log("I have just removed object with Id: "+ench.getId());

Xavion3 avatar Apr 20 '13 09:04 Xavion3