Curriculum Collections & iteration Hash maps exercise 5 · fill-word
Hash maps
Fill the method that returns the map's Entry API — used for
"get or insert default" in one shot.
TypeScript reference
Fill the blanks →
About this theme
HashMap<K, V> replaces many TypeScript object-as-map patterns, but lookups return Option<&V> and insertion may move keys and values. Planned exercises: 1. choose HashMap. 2. recognise insert. 3. choose .get() return type. 4. fill an import from std::collections. 5. fill entry(...).or_insert(...). 6. write a frequency counter. 7. write a lookup with a fallback. 8. translate TS record code. 9. fix a borrowed-key lookup without cloning unnecessarily.