I was trying to recreate the start screen of AngryBirds where there are projectiles shooting in the background. I tried slick2d with the following code
public void update(GameContainer gc, StateBasedGame game, int delta) throws SlickException {
    for (int a = 0; a < delta; a++) {
        if (pros.size() < 5) {
            pros.add(new MenuProjectile(Images.red[0]));
        }
        pros.iterator().forEachRemaining(p -> {
            if (p.getX() > gc.getWidth() || p.getY() > gc.getHeight()) {
                pros.remove(p);
            } else {
                p.update();
            }
        });
    }
}
And slick2d gives me the error
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
at java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:904)
at startmenu.Menu.update(Menu.java:29)
at org.newdawn.slick.state.StateBasedGame.update(StateBasedGame.java:266)
at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:663)
at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:411)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:321)
at state.Angrybird.main(Angrybird.java:29)
Thu Mar 29 21:07:04 SGT 2018 ERROR:Game.update() failure - check the game code.
org.newdawn.slick.SlickException: Game.update() failure - check the game code.
    at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:669)
    at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:411)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:321)
    at state.Angrybird.main(Angrybird.java:29)
    enter code here
Supposed that if I use iterators, this error should not be thrown. Please help!
