Due by the end of today by midnight
Notice that there are several methods in ArrayBag that are currently throwing UnsupportedOperationExceptions:
iterator
containsAll
addAll
removeAll
retainAll
Implement the containsAll
and addAll methods.
containsAll returns true
if this ArrayBag contains each and every item
in the Collection it was given.
You will note that the given Collection
has base type ?.
That means the Collection can be of any type.
That's fine,
because the ArrayBag's contains method
can be given any type of Object.
addAll adds every item from the given Collection
and returns true if the contents of this ArrayBag changed.
You will note that the given Collection
has base type ? extends T.
That means the Collection can be of any type
that extends the base type of this ArrayBag.
That means that every item in that Collection
is some kind of T,
and so the ArrayBag's add method
will accept it.
Submit this/these files: