HashTable and HashMap are data structures providing key-value access to data. Following are the basic differences between the two are: 1. HashTable provides default synchronization whereas HashMap does not. 2. Hashtable does not permit null values whereas HashMap does.
Hashtable is a legacy collection class. You shouldn't use it anymore; instead, you should always use HashMap. If you really need a synchronized map, you should use the method java.util.Collections.synchronizedMap(...), for example:
Hashtable should be used in the past, HashMap in the future.
Be darned sure you know what a synchronized map does before you count on it for thread safety. It's very likely you'll want to synchronize all the code that accesses the map instead of using a synchronized map.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi