title: How to avoid ConcurrentModificationException when iterating over a map and changing values?
body: <p>I've got a map containing some keys (Strings) and values (POJOs)</p>
  
  <p>I want to iterate through this map and alter some of the data in the POJO.</p>
  
  <p>The current code I've inherited removes the given entry, and adds it back in after making some changes to the POJO.</p>
  
  <p>This doesn't work well, since you shouldn't be modifying a map whilst your iterating through it (method is synchronised, but ConcurrentModificationException still appears)</p>
  
  <p><strong>My question is</strong>, if I need to iterate over a map and change values, what are the best practices/methods I can use for doing so? To create a separate map and build that up as I go, then return the copy?</p>