HashMap and HashTable | SoloLearn: Learn to code for FREE!


HashMap and HashTable

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

4/6/2017 8:44:42 AM


10 Answers

New Answer


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.


Hi Saumya, (lol, me saying hi to me) Yes I'm Indian. 😁


okay, I am confused too. 😉


Hey, I was searching this same question today. I too found the stack exchange and JavaTPoint explanations very helpful.


I found this useful http://stackoverflow.com/questions/40471/differences-between-hashmap-and-hashtable


hey @saumya same name...so frends!!😀😁


r u indian//dont mind plz


lets confuse d wrld..




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