Note: I am aware of the Iterator#remove()
method.
In the following code sample, I don\'t understand why the List.remove
in main
I had that same problem but in case that I was adding en element into iterated list. I made it this way
public static void remove(Integer remove) {
for(int i=0; i
Now everything goes fine because you don't create any iterator over your list, you iterate over it "manually". And condition i < integerList.size()
will never fool you because when you remove/add something into List size of the List decrement/increment..
Hope it helps, for me that was solution.