Why am I not getting a java.util.ConcurrentModificationException in this example?

后端 未结 10 2216
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-22 07:59

Note: I am aware of the Iterator#remove() method.

In the following code sample, I don\'t understand why the List.remove in main

10条回答
  •  醉梦人生
    2020-11-22 08:46

    Check your code man....

    In the main method you are trying to remove the 4th element which is not there and hence the error. In the remove() method you are trying to remove the 3rd element which is there and hence no error.

提交回复
热议问题