what is the difference between hashmap & hashtable?
4 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   srinu_rao
Posted On:   Friday, September 23, 2005 12:55 AM

what is the difference between hashmap & hashtable?

Re: what is the difference between hashmap & hashtable?

Posted By:   Indranil_Biswas  
Posted On:   Monday, October 17, 2005 06:01 AM

Hashmap is almost similar to Hashtable,but there are 2 differences between them.
1.Hashtable is synchronized and Hashmap is unsynchronized.
2.HashMap allows null values as key and value whereas Hashtable doesnt allow. Also note that only one NULL value is allowed as a key in HashMap. HashMap does not allow multiple keys to be NULL. Nevertheless, it can have multiple NULL values.

Re: what is the difference between hashmap & hashtable?

Posted By:   WarnerJan_Veldhuis  
Posted On:   Friday, September 23, 2005 08:10 AM

Solution is here

Re: what is the difference between hashmap & hashtable?

Posted By:   Jani_Kaarela  
Posted On:   Friday, September 23, 2005 02:16 AM


Lets all spell it out!

"F!" "A!" "Q!"

What do we get?! FAQ!



How about another one?!

"A!" "P!" "I!"

What's that you said?! API!

Re: what is the difference between hashmap & hashtable?

Posted By:   Anonymous  
Posted On:   Friday, September 23, 2005 01:32 AM

Hashtable has synchronization overhead, but unless you are
actually using multiple thread to access it this overhead is very low on most platforms. Contention is what make synchronization expensive. (also underlying JVM implementation details (which in trun depend on the hardware architecture))



HashMap has a more complex hashing algorithm then Hashtable. It takes the hash value from the key and then hashes it again (double hashing). This can improve the distribution of the
keys and hence the performance of the Map. It does take more
time to compute though. This is a useful feature as many
hashCode implementations are not very good.



It is also useful to remeber that HashMap and Hashtable do
NOT have the same specification. HashMap allows null keys/values while Hashtable does not.




------------

Jeff Parker

www.devsquare.com

DevSquare - Online Application Development
About | Sitemap | Contact