L07

Due by the end of this meeting

Starter Files:


SUBMIT   /   Submission Summary

Array Implementations

Activity 1
Download the class ArrayBag along with the interface Bag and the testing program TestAlls.

Revise ArrayBag by implementing the methods:

The required behaviour for each method should be obvious, but if you have any questions you can consult the javadoc linked above.

Things to keep in mind:

Once you have completed the changes, your output should look like this:

---- containsAll ---- Testing [10, 20, 10, 30, 42].containsAll([20, 42]) OK OK Testing [10, 20, 10, 30, 42].containsAll([10, 40]) OK OK ---- addAll ---- Testing [10, 20, 10, 30, 42].addAll([50, 5, 10]) OK OK Testing [10, 20, 10, 30, 42].addAll([]) OK OK ---- removeAll ---- Testing [10, 20, 10, 30, 42].removeAll([50, 5, 10]) OK OK Testing [10, 20, 10, 30, 42].removeAll([]) OK OK ---- retainAll ---- Testing [10, 20, 10, 30, 42].retainAll([50, 5, 10]) OK OK Testing [10, 20, 10, 30, 42].retainAll([10, 30, 42, 50, 20]) OK OK

Submit this/these files:


SUBMIT   /   Submission Summary