Task 3:
Look at the first two variants of the
orMapmethod (the recursively defined variant and the variant that uses thewhileloop. Identify the four parts (BASE-VALUE, Termination/Continuation PREDICATE, UPDATE, and ADVANCE) in each of them.Look also at the tests in the
Examplesclass.After you understand how the
whileloop works, design two variants of the method that produces a newArrayListthat contains all elements of the original list that satisfy the givenISelectpredicate.Test the methods by producing all albums released before the given year.
Design and test two variants of the andMap method that determines whether all elements of a given list satisfy the given
ISelectpredicate.Test the methods by producing all albums released before the given year.
10.4 Converting while loops into for loops
If you have the time left, repeat al the parts of Task 3 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.