ConcurrentModificationException when removing an item from an arraylist

Hey guys, in my game I keep track of entities such as the player and items in an arraylist


  public static ArrayList<Entity> entities = new ArrayList <Entity>();
  
  //this method adds entities to the "entities" arraylist
  public static void entityAdder(){
    entities.add(new Player(100, 100));
    entities.add(0, new ItemEntity (200, 200, 0, 1));
    entities.add(0, new ItemEntity (50,50, 1, 1));}

I have enhanced for loops in my program that draw each entity and keep track of their locations.

Right now I’m trying to work out how to pick up items and place them into my inventory, I figured to do this when I pick up the item i’ll need to remove it from my arraylist of entities so that my enhanced for loops dont draw them or keep track of their location anymore. Only thing is now when I go to pick the item up I get this exception.


Exception in thread "Thread2" java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(UnknownSource)
at java.util.ArrayList$Itr.next(Unknown Source)

Any ideas on how I could work around this?