Java Reference
In-Depth Information
Removes each element of
coll
from this collection, returning
true
if any removal required changing the collection. (Option-
al)
public boolean
retainAll(Collection<?> coll)
Removes from this collection all elements that are not ele-
ments of
coll
, returning
true
if any removal required changing
the collection. (Optional)
public void
clear()
Removes all elements from this collection. (Optional)
This
Collection
interface is purposely very general. Each specific collec-
tion type can define restrictions on its parameters or other related be-
havior. A collection may or may not accept
null
elements, may be re-
stricted to certain types of elements, may retain elements in a sorted
order, and so on. Each collection that makes a restriction should state
those restrictions in its documentation so that users can understand the
contract for that collection.