As far as I know, there is no easy way to make a ConcurrentHashMap or equivalent class that supports null keys or values.
ConcurrentHashMap very different from Collections.synchronizedMap(new HashMap()) .
First of all, because a synchronized card will prevent simultaneous simultaneous access at the same time, even if all calls are read-only. ConcurrentHashMap will not block concurrent read access and, in some cases, may even accept concurrent writes.
But all the more important, the Iterator returned by the synchronized map is prone to throwing a ConcurrentModificationException if the basemap changes when using an iterator. ConcurrentHashMap iterators, on the other hand, are guaranteed to never throw a ConcurrentModificationException , even if the basemap changes when using an iterator.
source share