0

Why is there no need for the concurrent hashmap to lock on read?

How does Concurrent Hash Map handle multi-threading during reads?

shmosel
  • 49,289
  • 6
  • 73
  • 138
Swapna
  • 1
  • 1

1 Answers1

0

Any variable(object) at any point of time should be in just one state.Locks are used to prevent assigning multiple states to a variable.

Read operation will never alter the state of the variable, instead it simply fetches the state of the variable (object) at that point of time.

Andy Sug
  • 234
  • 2
  • 7