Rust theorytheory 0/50 · 0%
Collections · easy

17. HashMap and HashSet

Key-value and unique-set storage.

`HashMap<K, V>` needs keys implementing Hash + Eq. `entry()` gives in-place insert-or-update, and `get` returns Option<&V>. HashSet is a HashMap with unit values; BTreeMap keeps keys sorted when ordering matters.

Check your understanding

  1. 1. Which API inserts-or-updates in one lookup?

  2. 2. Which map keeps keys sorted?