I read an article about thread safe maps and got a question. Collections.synchronizedMap() proxies underlying map with adding synchronized blocks on each method. On the other hand ConcurrentHashMap doesn't lock the whole map on read/write operations. Which means all operations in multi thread system are faster.
So what are the benefits of using synchronizedMap() nowadays? I see the only:
- it's available since java 1.2 (vs java 1.5 for
ConcurrentHashMap) - can store nullable values (if underlying map can do it)
Are there any other situations when synchronizedMap() is better?