Wristband Record Router
The clinic filing robot is checking every folder, one by one. Connect each unique wristband key to its record so the right care can be found directly!
π§ Before we start
At Encore Theater, a stack remembered which routine should return next. Today we need a different data tool: a key-value map. Each unique key points straight to one value, so a program can find, replace, or remove information without searching the whole pile.
Connect keys to values
Tap a wristband key, then tap its matching patient record. Every key must point to exactly one value.
Use direct lookup
The scanner shows a key. Open the drawer with that exact keyβone check is enough when the map already knows the connection.
Update one stored value
FOX-2 now needs an allergy alert. Choose the safe update. A map changes the value behind the same key instead of making a duplicate key.
Debug the duplicate key
A broken importer made two BEE-8 entries. Repair the map so one key has one clear value.
π What you learned
- A key-value map stores each value behind a unique key.
- A program can use a known key to look up its value directly.
- Setting an existing key updates its value; it does not add another key.
- Duplicate keys make lookup results unclear and must be repaired.
- Maps power profiles, settings, inventories, scores, and many real apps.