More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. HashTable locks the complete collection to provide synchronization whereas ConcurrentHashMap only locks segments to achieve synchronization and hence better efficient and faster.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Yes, they both aim at providing synchronized access to the Map collection. The only difference is in their implementation. ConcurrentHashMap came after HashTable and hence technically more efficient as it doesn't lock the complete map while accessing it.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Both provide the thread safety but the actual difference come when talk about performance. CHM gives best performance when no of writer threads are less in number.
Help us improve. Please let us know the company, where you were asked this question :
Ans. ConcurrentHashMaps provide unlimited read operation fro multi threaded environment. For write operation only one thread can change value for particular segment of map.
Help us improve. Please let us know the company, where you were asked this question :