Understanding orMap

Converting while loops into for loops

Repeat all the parts of the previous task with the remaining two variants of the orMap — namely the one that uses the for loop with the Traversal and the one that uses counted for loop.

For Each

Optionally, you may look at the ultimate abstraction of these traversals shown in the ForEach class.

  1. Read the tests for for each variant of the compute method of the ForEach class shown in the Examples class. Make sure you understand how they work. Design additional tests for each of the three compute methods.