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.
|