Guys,
please provide me with some explanations concerning WHY I get this exceptions.
(1) Several similair threads modify the same arraylist concurrently. No synchronization provided. I receive the message:
java.lang.ArrayIndexOutOfBoundsException: 200
at java.util.ArrayList.add(Unknown Source)
at solutiondatabase.CollectionGamesExample$MyThread.run(CollectionGamesExample.java:19)
Why? add can throw IndexOutOfBounds, but only if I make add(index, Object) where index > list.size(). But here I just add elements to the end of the list!
(2) This code results in ConcurrencyModificationException:
Why? I even dont have several threads here! Or may be its not about concurrency and the Exception name is misleading in this case?