View Full Version : Java API question

March 7th, 2009, 05:04 AM
Does anyone know what the differences are between ConcurrentHashMap and HashMap in the Java API...

March 7th, 2009, 05:14 AM
looks like concurrentHashMap is thread safe and HashMap is not.

Most data structures in java have a thread safe type and one that is not.

March 7th, 2009, 06:40 AM
Use ConcurrentHashMap if your app is multi-threaded and it's possible to have multiple threads operating on the map at the same time (e.g. one enumerating it while another is updating it).

March 7th, 2009, 07:53 PM
Thank you...that was a recent interview question...