HashMap and HashTable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

HashMap and HashTable

What is the basic difference between HashMap and HashTable. In which situations each one of two is best to use

6th Apr 2017, 8:44 AM
Sbk0103
Sbk0103 - avatar
10 Answers
+ 13
Well, Hashtable is synchronized, whereas HashMap is not.this makes HashMap better for non-threaded applications, as unsynchronized objects typically perform better than synchronized ones. and also hashtable does not allow null keys or values. hashMap allows one null key and any number of null values.
15th Apr 2017, 9:12 AM
Don MTY
Don MTY - avatar
+ 10
Hi Saumya, (lol, me saying hi to me) Yes I'm Indian. 😁
7th Apr 2017, 1:05 AM
Saumya
Saumya - avatar
+ 10
okay, I am confused too. 😉
7th Apr 2017, 1:07 AM
Saumya
Saumya - avatar
+ 9
Hey, I was searching this same question today. I too found the stack exchange and JavaTPoint explanations very helpful.
6th Apr 2017, 12:18 PM
Saumya
Saumya - avatar
6th Apr 2017, 11:19 AM
Heng Jun Xi
Heng Jun Xi - avatar
+ 7
hey @saumya same name...so frends!!😀😁
6th Apr 2017, 7:16 PM
Saumya
Saumya - avatar
+ 5
r u indian//dont mind plz
6th Apr 2017, 7:17 PM
Saumya
Saumya - avatar
+ 5
lets confuse d wrld..
7th Apr 2017, 1:06 AM
Saumya
Saumya - avatar
+ 5
😉😉
7th Apr 2017, 1:06 AM
Saumya
Saumya - avatar
0
Both HashTable and HashMap implements Map interface but there are some differences between these two. They are: Thread Safety (synchronized) Null Keys Inheritance Performance Traverse Fail-safe Time Complexity Legacy Full Source http://net-informations.com/java/cjava/hashmap.htm
4th Jul 2017, 5:20 AM
rahul kumar
rahul kumar - avatar