+ 2
HashMap and HashTable
What is the basic difference between HashMap and HashTable. In which situations each one of two is best to use
10 Antworten
+ 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.
+ 10
Hi Saumya, (lol, me saying hi to me) Yes I'm Indian. 😁
+ 10
okay, I am confused too. 😉
+ 9
Hey, I was searching this same question today. I too found the stack exchange and JavaTPoint explanations very helpful.
+ 8
+ 7
hey @saumya same name...so frends!!😀😁
+ 5
r u indian//dont mind plz
+ 5
lets confuse d wrld..
+ 5
😉😉
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