NOTE
HashSet
Hash-based Set semantics, equality/hashCode requirements, null handling, and concurrency characteristics.
This is a historical learning note and may contain outdated or incomplete understanding.
HashSet provides uniqueness using hash-based membership, conceptually backed by a hash map.
Correct behavior depends on the equals/hashCode contract. Mutating fields that participate in equality/hash calculation while an object is stored in the set can make lookups behave unexpectedly.
HashSet is not thread-safe. Use external synchronization or a concurrent set representation when shared mutation is required.