Skip to content

Glossary: Coding Interviews in Java

HashMap / HashSet

Also written: HashMap, HashSet, hash map, set, map

Java collections for fast lookups: a `HashSet` answers 'have I seen this?' and a `HashMap` stores counts or other values by key, both in O(1) on average. A `HashMap` makes no promise about its printing order.

Where the book teaches it

Related terms

Trading space for timeLinkedHashMap / TreeMap