Monday 6 May 2013

Difference between ConcurrentHashMap and Collections.synchronizedMap


  • ConcurrentHashMap is designed for concurrency and improve performance while HashMap which is non synchronized by nature can be synchronized by applying a wrapper using Collections.synchronizedMap 
  • ConcurrentHashMap do not allow null keys or null values while HashMap allows null keys. 
  • In case of multiple reader and Single writer ConcurrentHashMap is best choice.

No comments:

Post a Comment