Having read other questions on here I believe I would be right in saying that this error occurs when you are trying to modify the children of a node while iterating over it.
I saw a couple of methods I could use to overcome this issue, however when I was messing around with my code I noticed that by replacing my enhanced for loop with a regular for loop it solved the issue.
My first question is why does this work? It would seem to me that I am still modifying the children of a node while iterating over them, so I don't understand why this now works. Secondly, is there anything wrong with overcoming the error in this way?
Update
As requested, here is a snippet of code
    ArrayList<Button> list = new ArrayList<Button>();
    Button b1 = new Button();
    Button b2 = new Button();
    Button b3 = new Button();
    Collections.addAll(list, b1, b2, b3);
    //Error
    for(Button b : list) {
        list.remove(b);
    }
    //No Error
    for(int i = 0; i < list.size(); i++) {
        Button b = list.get(i);
        list.remove(b);
    }
 
     
     
    