Keyboard

↓ ↑
move between the rows you can see
→
open a feature, then step into it
←
close a feature, or step out to the one above
Enter
go to the page in focus
Tab
the same rows, plus everything else on the page
/
search the whole report
m
open or close the navigation drawer
Esc
leave the search box, or close the drawer
?
this list

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.

expected outcome broken scenario
ScenarioMap inputKey order?Value order?
Written ascending
a
1
b
2
c
3
  • a
  • b
  • c
  • 1
  • 2
  • 3
Keys written unsorted
c
1
a
2
b
3
  • c
  • a
  • b
  • 1
  • 2
  • 3
Values written descending
a
3
b
2
c
1
  • a
  • b
  • c
  • 3
  • 2
  • 1