0% found this document useful (0 votes)
3 views1 page

HashMap vs HashTable: Key Differences

HashMap and HashTable are both data structures used in Java, but they have key differences. HashMap is not synchronized, offers higher performance, and allows multiple threads, while HashTable is synchronized, has lower performance, and allows only one thread at a time. Additionally, HashMap was introduced in version 1.2, is not a legacy class, whereas HashTable was introduced in version 1.0 and is considered a legacy class.

Uploaded by

sagartribhuvan21
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

HashMap vs HashTable: Key Differences

HashMap and HashTable are both data structures used in Java, but they have key differences. HashMap is not synchronized, offers higher performance, and allows multiple threads, while HashTable is synchronized, has lower performance, and allows only one thread at a time. Additionally, HashMap was introduced in version 1.2, is not a legacy class, whereas HashTable was introduced in version 1.0 and is considered a legacy class.

Uploaded by

sagartribhuvan21
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

HashMap HashTable

Not methods is synchronized All methods is synchronized


Performance is high Performance is low
At time multiple threads are allowed At time only one thread is allowed
It is not thread safe It thread safe
It is introduced in 1.2 v It is introduced in 1.0 v
It is not legacy class It is legacy class

You might also like