Task 3:
Look at the first two variants of the orMap method (the
recursively defined variant and the variant that uses the
while loop. Identify
the four parts (BASE-VALUE, Termination/Continuation PREDICATE,
UPDATE, and ADVANCE) in each of them.
Look also at the tests in the Examples class.
After you understand how the while loop works, design two
variants of the method filter that produces a new
ArrayList that contains all
elements of the original list that satisfy the given ISelect
predicate.
Test the methods by producing all albums released before the given year.
Optional — skip and finish at home, if necessary
Design and test two variants of the andMap
method that determines whether all elements of a given list satisfy
the given ISelect
predicate.
Test the methods by producing all albums released before the given year.
If you have the time left, repeat all 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.
At home, add to your lab project a new class that represents data of
your choice, design an ISelect predicate for that class of
data, and test all methods on ArrayLists of your data.