Hash Maps (`HashMap<K, V>`): Storing Key-Value Pairs
We've explored how to store a sequence of items in a vector. But what if you want to associate a value with a key, so you can look it up later? For this, Rust provides the hash map, or HashMap.
We've explored how to store a sequence of items in a vector. But what if you want to associate a value with a key, so you can look it up later? For this, Rust provides the hash map, or HashMap.
It's time to put everything we've learned about collections into practice. In this project, we will build a program that counts the occurrences of each word in a given text. This is a classic programming exercise that is a perfect way to use the HashMap to solve a real-world problem.