Hashmap and Hashtable both accept key-value pairs with a prime difference, i.e. Hashmap permits null values where as hash table doesn't.
Another difference being while iterating over the hashMap, if another object tries to modify the structure of hashmap object, then it throws a ConcurrentModificationException. Hashtable is synchronized and only one thread can modify it at any point of time.
SirG
The javadoc for HashMap says:
"...(The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.) ..."
When to use:
if you need synchronization (Multithreaded app) prefer to use Hashtable [or Collections.synchronizedMap(new HashMap(...))], else the HashMap (probably a little bit faster).
[]
My guidelines (similar for Vector)
Use Hashtable only when forced to by an interface you are using (eg as a parameter to the constructor in javax.naming.InitialContext: new InitialContext(Hashtable environment)
Otherwise use HashMap. If you require synchronization, use Collections.synchronizedMap.