- Main Difference is HashMap is Non-synchronized, where as HashTable is synchronized. Which means Hash table is thread safe, so in multi threaded environment user no need to worry while performing operations on HashTable. But HashMap is not synchronized, so it is users responsibility to synchronize the things in Multi threaded Environment.
- HashMap allows null valuses as key, but HashTable won't allow null values.
- Since Synchronization is costliest operation, HashTable is slower than HashMap in single threaded Environment.
This blog is primarily focus on Java fundamentals and the libraries built on top of Java programming language. Most of the post are example oriented, hope you have fun in reading my blog....:)
Saturday, 19 July 2014
Difference between HashMap and HashTable
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment