Hi,
What is the difference between Hash Map and Hash Table in Java ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prabhu RajaPosted Oct 22, 2011, 12:04 AM
Hope it will useful for you.
HashMap
Satyapriya NayakPosted Oct 21, 2011, 11:45 PM
1.Hashtable is synchronized while access to the HashMap is not synchronized.
2.HashMap allows null values as Key, while Hashtable doesn't.
3.Iterator in a HashMap is fail-safe(Fail-safe is relevant from the context of iterators.If an iterator has been created on a collection object and some other thread tries to modify the collection object "structurally",a concurrent modification exception will be thrown) while the enumerator of HashTable is not.
Thanks
Javeed M ShaikhPosted Oct 21, 2011, 10:41 PM
1. Hashtable is synchronized and whereas HashMap is not.
2. Hashtable does not allow null keys or values. HashMap allows one null key and any number of null values.
Please do not forget to mark "Accepted Answer".