Tag: at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013)

CopyOnWriteArrayList

Let’s look into below example code. The only difference between these blocks is type of iteration. Example 1 uses Iterator and Example 2 uses for each loop. Running either of above example will result in below exception. So, what this exemption conveys us ? We are not allowed to modify the list during iteration. We […]