Due by the end of this meeting
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:
iterator,
contains
and toArray methods available.
You might use any/all of them in your implementations.
iterator method
returns an Iterator.
If the base type of the Collection
is <? extends T>
then the Iterator's base type is T.
If its base type is just ?, however,
the Iterator's base type is Object.
true if the contents of the Bag change,
and false otherwise.
removeAll method
should remove every copy of each of its elements
from the Bag.
For example,
if the argument contains a 10,
then every 10 should be removed from the Bag.
Try to do that efficiently!
contents array.
You'll just have to mess around with the loop control variable
if you remove items.
Once you have completed the changes, your output should look like this:
Submit this/these files: