Home Java SCJP SCWCD Servlet Submit News Contact Us Site Map


Over 500 magazines for free (including Oracle Magazine)!

Yes all of them are FREE. You can subscribe to ALL of them.
Click here to apply today!

Home > Java > Java Articles

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 powers of two.

Home Java SCJP SCWCD Servlet Site map