19. Iterator
MediumBehavioural1 hidden requirement
Letting a collection hand out the walk, so how it stores things stays its own business
Attendance reads out a roster, and the tests pass.
It does it by asking how many names there are and then asking for each one by position — so it depends not just on the roster, but on the roster being the kind of thing that has positions.
Roster already hands out a Cursor. Rewrite roll() to use it: hasNext(), then next().
Run compiles every file and runs Tests.java — the tests you can read.
Submit runs those again, then applies 1 requirement you have not seen, one at a time.
Your code is never edited. Each requirement is added to the project as it stands. If the design is right, nothing you wrote has to change.
- Ctrl/⌘ + Enter runs the tests
Run the tests to see where you are.
Hidden requirements
Stdout
TERMINALPROBLEMSOUTPUT
Try:
honeytrap shell. Two commands are wired up: cd and cat.