#define PERSONAL_OPINION
From a design point of view, it makes sense to always use
Map m = Collections.synchronizedMap(new HashMap()); ... Set s = m.keySet();
example in synchronizedMap
Why? Since the synchronization mechanism is tied to high abstraction ( Map interface). But assuming I'm right, there may be two reasons still having ConcurrentHashMap :
- There is a
ConcurrentHashMap front of this synchronization engine. - Or there is a performance boost when creating a specific synchronized mechanism.
My point in an ideal world of design, even ConcurrentHashMap should not exist.
#end
source share