Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.unifiedtech.demo;
- import java.util.ArrayList;
- public class Program
- {
- public static void main(String[] args)
- {
- ArrayList<Integer> list = new ArrayList<Integer>();
- for(Integer i = 0; i < 100; i++)
- list.add(i);
- for(int i : list)
- if ((i % 2) == 0)
- list.remove(list.indexOf(i));
- }
- }
- Exception in thread "main" java.util.ConcurrentModificationException
- at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
- at java.util.AbstractList$Itr.next(Unknown Source)
- at org.unifiedtech.demo.Program.main(Program.java:14)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement