A HashSet organizes elements by hash codes so membership checks can compare hashes before comparing values. For objects with custom equality, equals and hashCode must agree: equal objects must produce the same hash code. section 4.3.1
Equal customers in a HashSet
val processed = hashSetOf(Customer("Alice", 342562)) println(processed.contains(Customer("Alice", 342562))) // false If Customer overrides equals but not hashCode, the two equal-looking instances can have different hashes, so the set rejects the second instance. An implementation such as `override fun hashCode(): Int = name.hashCode() * 31 + postalCode` restores the contract. section 4.3.1
Kotlin provides several ways to create set implementations:
- `java.util.HashSet` is represented from Kotlin as a MutableSet-compatible Java collection, without wrappers or copied data. section 8.2.3

