removing enemy and bullet in collision java -
this question has answer here: iterating through collection, avoiding concurrentmodificationexception when removing in loop 17 answers i making simple 2d game in java. have created controller class , created linked lists zombies(enemies) , bullets. in gamestate class trying use each loops loop through linked lists , detect if there collision bullet , zombie. way laid out below in code example, enemy can removed game, if try remove bullet well, game crashes. wondering if ideas on how can remove both entities after collision occurs. this error when bullet collides enemy exception in thread "thread-1" java.util.concurrentmodificationexception @ java.util.linkedlist$listitr.checkforcomodification(unknown source) @ java.util.linkedlist$listitr.next(unknown source) @ android.game.gamestate.update(gamestate.java:71) @ android.game.game.update(game.java:121) @...