Difference Between Hashtable and ConcurrentHashmap

Prior one is part of Synchronised Collection classes Hashtable and Vector are also Synchronised Wrapper classes

  • Allows NULL values
  • Where,Collections.synchronizedMap and Collections.synchronizedList, provide a basic conditionally thread-safe implementation of Map and List
  • Have to lock single collection wide lock to avoid ConcurrentModificationException and which would impediment to scalability
  • Once the size of Hashtable increases , locking is done for longer duration to iteration, which would degrade the performance
    Later one is introduced for the concept of segmentation ,so

  • Does not allow NULL values

  • Larger it becomes only certain part of it get locked to provide thread safety
  • Used for high volume low latency apps
  • Readers can access map without waiting for iterations to complete