HashMaps

Learn how HashMaps are really key-value stores, a very useful data type.

Hashs, maps, and sets

We need to clarify one thing before going on. Programmers are nerds who like fancy, nerdy-sounding names.

In many programming languages, Rust included, we have HashMaps, HashSets, and Hash-a-lot-of-things. Ultimately, the best way to understand what they are is just to pretend the word hash isn’t there.

In these names, hash refers to a method of storing and retrieving data but does not contribute to our understanding of what these data structures are.

So, for our purposes, HashMap = Map, which is a data structure that maps something to something else.

Similarly, HashSet = Set, which is like a mathematical set. We’ll explore HashSets in detail in the next section.

With all that being said, let’s move on to the meat of this chapter.

Get hands-on with 1200+ tech skills courses.