[Solved] ConcurrentModificationException - How to avoid it

Hi

So I have a class called PopUps that renders all PopUp objects, or if they have been marked disposed, they are removed from the list in PopUps. Anyways, the list, once empty, throws a ConcurrentModificationException. I don’t know what to do to fix this, so I brought the question here.


   /**
	 * Render all popups
	 */
	public void render(){
		
		for(PopUp popup : popups){ // This line is where the exception is thrown.
			if(popup.isDisposed()){
				popups.remove(popup);
				continue;
			}
			popup.render();
		}
		
	}

Any thoughts? If you need to see more code just ask :slight_smile:

CopyableCougar4