forum

Home / DeveloperSection / Forums / difference between ConcurrentHashMap and Collections.synchronizedMap(Map)?

difference between ConcurrentHashMap and Collections.synchronizedMap(Map)?

Anonymous User187929-Jul-2015
I have a Map which is to be modified by several threads concurrently.

There seem to be three different synchronized Map implementations in the Java API:

1.Hashtable
2.Collections.synchronizedMap(Map)
3.ConcurrentHashMap
From what I understand, Hashtable is an old implementation (extending the obsolete Dictionary class), which has been adapted later to fit the Map interface. While it is synchronized, it seems to have serious scalability issues and is discouraged for new projects.

But what about the other two? What are the differences between Maps returned by Collections.synchronizedMap(Map) and ConcurrentHashMaps? Which one fits which situation?

Updated on 29-Jul-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By