NOTE

Hashtable

Legacy Hashtable synchronization, null restrictions, and modern replacement choices.

JavaCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

Hashtable is a legacy synchronized map. Its methods synchronize coarsely and it does not permit null keys or values.

For non-concurrent code, prefer HashMap. For shared concurrent access, prefer ConcurrentHashMap or another concurrent structure whose atomic operations and iteration semantics fit the workload.

As with other synchronized collections, individual synchronized methods do not automatically make arbitrary multi-step workflows atomic.

Loading helpful count