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.comDevSquare - Online Application Development