Hashmap and Hashtable

Which one is better and faster between hashmap and hashtable? Explain the situation where you would use them ?

Questions by krishnan_java

Showing Answers 1 - 7 of 7 Answers

srishailam

  • Jul 22nd, 2011
 

these are collection classes, which are used to store the different objects in one object .Hashmap is synchronized, but Hashtable not synchronized . when we are working on a single thread Hashtable gives more performance than Hashmap.

  Was this answer useful?  Yes

sivabalan

  • Jul 25th, 2011
 

Common thing: Both will store Key and Value pairs.
As per HashMap, Its not synchronized. Key and Value will allow null values.
As per HashTable, Its synchronized. Key will not allow null values.

  Was this answer useful?  Yes

Hashmap is not synchronized where as HashTable is synchronized. HashMap is faster than HashTable at the cost of synchronization and there is no point of null and value pairs in HashTable where as in HashMap it exists..so HashMap is faster than HashTable

  Was this answer useful?  Yes

sampra

  • Mar 13th, 2012
 

HashMap is Faster then Hashtable because Hashtable has synchronized method so use Hashtable when you want synchronization other wise prefer HashMap

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions