Hashset
A hash set is a collection of distinct values that uses hashing to support efficient membership testing without associated values.
Fabulous Adventures in Data Structures and Algorithms
HashSet<T> is a .NET collection type that stores unique values and supports hash-based membership and lookup operations.
- How it is used
- Supports fast word-membership tests while serving as a rejected alternative for prefix-oriented word-list searches.
- How deep it goes
- Explains hashing, buckets, complexity, equality contracts, and mutation hazards, but stops short of implementing the collection itself.
- Examples
- Uses large word lists, Contains, StartsWith, and structurally equivalent mutable graph nodes as examples.
- What you can do after
- Evaluate hash sets for membership workloads and implement compatible equality and hashing for stored objects.
Read how Fabulous Adventures in Data Structures and Algorithms explains hashset →
Kotlin in Action, 2E
HashSet is a set implementation that organizes elements using hash codes for efficient membership testing.
- How it is used
- Uses hash codes to implement set membership checks, especially when storing objects with value-based equality.
- How deep it goes
- Explains hash-first comparison and the equals/hashCode contract, then stops short of implementation internals beyond a hashCode example.
- Examples
- Uses two equal-looking Customer instances named Alice and compares Kotlin hashSetOf with java.util.HashSet interoperability.
- What you can do after
- Diagnose membership failures by checking whether equal objects return the same hash code.
Related concepts
- equality by valueuses · Equality by value is an equality semantics in which values are considered equal when they represent equivalent contents, regardless of object identity.
- hash valueuses · A hash value is a deterministic, typically fixed-size value produced by applying a hash function to input data, often for lookup, comparison, identification, or integrity checking.
- Mapkind of · A map is an associative data structure that stores key-value pairs and supports retrieving values by key.
- setused by · A set is a collection of unique elements in which membership is determined by whether an element is present, not by duplicate occurrences.
- bloom filteralternative to · A Bloom filter is a space-efficient probabilistic data structure for testing set membership that permits false positives but not false negatives.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

