Java Reference
In-Depth Information
public void clear()
Removes all the elements from the calling object.
Throws:
UnsupportedOperationException if the clear method is not supported by the
calling object.
public boolean remove(Object element)
Removes the element from the calling object, if it is present. Returns true if the calling object
contained the element ; returns false otherwise.
Throws:
ClassCastException if the type of element is incompatible with the calling object (optional).
NullPointerException if element is null and the calling object does not support null
elements (optional).
UnsupportedOperationException if the remove method is not supported by the calling object.
public boolean removeAll(Collection<?> collectionToRemove) (Optional)
Removes all the calling object's elements that are also contained in collectionToRemove.
Returns true if the calling object was changed; otherwise returns false.
Throws:
UnsupportedOperationException if the removeAll method is not supported by the
calling object.
ClassCastException if the types of one or more elements in collectionToRemove are
incompatible with the calling object (optional).
NullPointerException if the calling object contains a null element and
collectionToRemove does not support null elements (optional).
NullPointerException if collectionToRemove is null.
public boolean retainAll(Collection<?> saveElements) (Optional )
Retains only the elements in the calling object that are also contained in the collection
saveElements. In other words, removes from the calling object all of its elements that are not
contained in the collection saveElements. Returns true if the calling object was changed;
otherwise returns false. If the argument is itself a Set <T> , this changes the calling object to
the intersection of itself with the argument.
Throws:
UnsupportedOperationException if the retainAll method is not supported by the
calling object.
ClassCastException if the types of one or more elements in the calling object are
incompatible with saveElements (optional).
NullPointerException if saveElements contains a null element and the calling object
does not support null elements (optional).
NullPointerException if saveElements is null.
 
Search WWH ::




Custom Search