Iterates a map in the order the cell wrote its entries
All 3 scenarios hold
A collection cell decides the order its parameter iterates in. Elements come out in the order the cell wrote them. They are never sorted, and never in a hash order of their own. An order-sensitive assertion against a List, Set, or Map parameter is therefore safe to write.
The elements below are text throughout, so nothing here varies the element type. The guarantee is about position, and Parameterized collection element types is where the element type is the subject.
Each rule shows the parameter's iteration as a list. A row whose input is already in ascending order proves nothing on its own. The rows that reverse or shuffle the written order are the ones that pin it down.
The rule reads the keys and the values off the same map, entry by entry.
| Scenario | Map input | Key order? | Value order? |
|---|---|---|---|
| Written ascending |
|
|
|
| Keys written unsorted |
|
|
|
| Values written descending |
|
|
|