GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Oracle  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 20 of 134    Print  
What is the difference between HashTable and HashMap?

  
Total Answers and Comments: 3 Last Update: October 03, 2009   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 14, 2005 03:21:52   #1  
Varsha Sharma        

RE: What is the difference between HashTable and HashMap?
Hashtable is synchronized means it's therad safe where as hashmap is not .
and hash table can't store null value hashmap can store null values.

 
Is this answer useful? Yes | No
September 19, 2009 15:55:44   #2  
kumpsath Member Since: September 2009   Contribution: 3    

RE: What is the difference between HashTable and HashMap?
Hashtable is synchronized means it's therad safe where as hashmap is not and hash table can't store null value hashmap can store null values. HashTable is thread safe is because it makes lock in it when it executes get() or put() methods. It is good one when you use the data in an multi-threading application. You may try use hashmap inside synchronized block.
 
Is this answer useful? Yes | No
October 03, 2009 01:45:48   #3  
bhushanamca Member Since: July 2009   Contribution: 2    

RE: What is the difference between HashTable and HashMap?
Hashtable does not allow null values or null keys whereas hash map allows null keys and null values. Hashtable is synchronzied whareas hashmap is not synchronized. In case of single thread using hashmap is faster than the hashtable. In case of multiple thereads using hashtable is advisable.
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape