I need to edit the contents of chunkLarge
, so I am trying to move them into a duplicate GridPane:
chunkLarge2 = new GridPane();
for (Node n : chunkLarge.getChildren()) {
chunkLarge2.add(n, GridPane.getColumnIndex(n), GridPane.getRowIndex(n));
}
This throws a ConcurrentModificationException
. I think it's because of GridPane.get...Index(n)
.
I did a bit of searching online, and found a few things.
One was that I could use an Iterator to cycle through lists, but I am unsure how to apply it here.
Next was that I could try .getChildrenUnmodified()
instead of your standard .getChildren()
, but this just threw NoSuchElementException
instead.
Any ideas?