Reputation: 297
I have a code like below to loop through the hashmap but I am getting error
ConcurrentModificationException
for (String i : currentItems.keySet()) //I am hitting error in this line
{
items.put(i,currentItems.get(i));
currentRoom.removeItem(i);
System.out.println(items.get(i));
}
I would appreciate any suggestion in the above.
Upvotes: 0
Views: 40
Reputation: 2360
Please refer to this question
Upvotes: 2