Users Pricing

forum

Home Forums difference between ConcurrentHashMap and Collections.synchronizedMap(Map)? – MindStick

difference between ConcurrentHashMap and Collections.synchronizedMap(Map)?

Anonymous User 2496 29 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?

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md