Created
March 4, 2013 23:41
-
-
Save lobster1234/5086686 to your computer and use it in GitHub Desktop.
ConcurrentModificationException - How to get one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Map { | |
public static void main(String[] args) { | |
HashMap<Integer,Long> map = new HashMap<Integer,Long>(); | |
for(int i = 0;i<100;i++){ | |
map.put(i,System.nanoTime()); | |
} | |
Iterator<Integer> it = map.keySet().iterator(); | |
while(it.hasNext()){ | |
map.remove(it.next()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment