I have some code. It used to be like this,
for(Shape s: shapes){
g.setColor(Color.blue);
g.fill(sh);
g.setColor(Color.gray);
g.draw(sh);
}
but it threw a ConcurrentModificationException, so I changed it to use iterators like this,
Iterator<Shape> s = shapes.iterator();
while(s.hasNext()){
Shape sh = s.next();
g.setColor(Color.blue);
g.fill(s);
g.setColor(Color.gray);
g.draw(s);
}
but it still throws a ConcurrentModificationException. Maybe it's because it gets called in the paint method, but that's because it is when it gets drawn.