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 list or set in the order the cell wrote it

All 4 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.

Both input columns hold the same elements in the same order.

expected outcome broken scenario
ScenarioList inputSet inputIteration order?
Written ascending
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
Written descending
  • 3
  • 2
  • 1
  • 3
  • 2
  • 1
  • 3
  • 2
  • 1
Written unsorted
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3
  • 1
  • 2
Reverse alphabetical
  • c
  • b
  • a
  • c
  • b
  • a
  • c
  • b
  • a