Thursday, May 6, 2010

HashMap vs ConcurrentHashMap

Both HashMap and ConcurrentHashMap are inherits some characteristics of Hashtable. But they have some prominent differences in context with performance, scalability.

HashMap
  1. Since Java 1.2
  2. Allows null key and value
  3. Poor performance in highly threaded applications
  4. Not much scalable
  5. Throws a ConcurrentModificationException
  6. Faster in non-multi threading applications

ConcurrentHashMap
  1. Since Java 1.5
  2. Doesn't allow null key or value
  3. Better performance in Highly threaded applications
  4. Highly scalable
  5. Do not throw ConcurrentModificationException
  6. Slower in non-multi threading applications


No comments:

Post a Comment