Home  >  Forum  >  Core Java
Post New Query

Difference between synchronized HashMap and HashTable?


joined on
December 18,2014
Asked on December 18,2014
As we know that we can synchronize Hash Map as Collections.synchronizedMap(map).
 HashTable is already synchronized.
So what is difference between synchronized HashMap and HashTable?
joined on
April 20,2017
Replied on April 20,2017

Hashtable is synchronized, whereas HashMap is not synchronized. This makes HashMap better for non-threaded applications, as unsynchronized Objects typically perform much better than synchronized ones. Synchronized means only a single thread can modify a hashtable at one point of time. Basically, that means any thread before performing an update on a hashtable will have to acquire a lock on the object while others will wait for lock to be released.

Write Answer









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us