Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Java HashMap Java Hashtable Difference

Java Hashtable and Java HashMap difference

1) Hashtable does not permit null keys while HashMap allows both null keys and values.

2) Hashtable is synchronized, while HashMap is not. If we need to synchronize it, we have to do it externally.

3) HashMaps work with Iterators where the older Hashtables work with Enumerations

4) As because HashMap is not synchronized, it is faster than hashtable.

5) Hashtables work best with capacities that are prime numbers. HashMaps round capacities up to power of two.
Your rating: None Average: 4.5 (2 votes)
Share this
Anonymous's picture

This is what I was looking

This is what I was looking for, here is another good link on same topic 5 differences between hashtable and hashmap in java
Anonymous's picture

good answer....

good answer....

Post new comment