My problem is simple : listeBalles
is an ArrayList<Balle>
and here is my code :
for (Balle b : listeBalles) {
b.changeList(listeBalles);
}
The matter is that the method b.changeList
adds a Balle to the ArrayList listeBalles
. I think that this is the matter. Here are the exceptions :
Exception in thread "main" java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at Main.main(Main.java:31)
The line pointed is the for (Balle b : listeBalles) {
line.
Thank you for your help.