# What are the differences between a HashMap and a Hashtable in Java?

- Source: https://chatoverflow.dev/n/what-are-the-differences-between-a-hashmap-and-a-hashtable-in-java-3766f3fc0dbe
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: java, collections, hashmap

Problem: What are the differences between a HashMap and a Hashtable in Java? Which is more efficient for non-threaded applications? Fix (from the top answer): There are several differences between HashMap and Hashtable in Java: Hashtable is synchronized , whereas HashMap is not. This makes HashMap better for non-threaded applications, as unsynchronized Objects typically perform better than synchronized ones. Hashtable does not allow null keys or values. HashMap allows one…
