It looks like you're new here. If you want to get involved, click one of these buttons!
Can someone please explain the difference between a HashMap and a Hashtable in Java? Please also let me know which is more efficient for java applications which doesn't have multi-threading applied.
HashMap is not synchronized.
Hashtable is synchronized.
The HashMap class extends AbstractMap and implements the Map interface. It does not add any methods on its own. Hashtable implements a hash table. It stores key/value pairs in a hash table i.e. keys are mapped to values. Key and value can be any non-null object. For more details and for practice programs please follow the link http://java.meritcampus.com/t/182/Hashmap http://java.meritcampus.com/t/221/Hashtable