So, if you are accessing this data HashMapfrom multiple threads, then you need to have a block synchronizedfor each access. Just because you grab a cached copy does not mean that other threads can use datawithout synchronization.
If you want simultaneous use HashMapwithout the need for synchronization around each use, you should use ConcurrentHashMap.
The whole application works fine, but my questions are: is there a better way to make this copy of thread 1 data for thread 2 without using the new keyword to create a whole new object?
, , HashMap, , , , . , Collection , iterator.remove().
, data.keySet() data.values().