• In Concurrent HashMap allows concurrent Read and Thread Safe ‘update’ operation
  • To perform Read operation thread will not require any lock but perform update operation thread require a lock, but it is a lock of the particular part(segment/bucket) map instead of total Map.
  • Concurrency update achieved by internally dividing by concurrency level (number of locks).

concurrency level(No. of locks) = 16 (default capacity)

  • By default, ConcurrentHashMap maintains 16 locks, one for one segment or bucket.
  • ConcurrentHashMap allows any number of reading operations but 16 updates operation at a time by default.
  • NULL not allow for key and value.
  • While the one thread iteration map,the other thread can perform update operation and it will not throw concurrent Modification Exception.

How Performance Increases

  • For read operation lock not require
  • for update /write operation lock a particular part/segment/bucket but not lock all map

So it get increased performance by concurrent HashMap.