|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection
public abstract class AbstractCollection
AbstractCollection is an abstract implementation of the Collection interface. This implementation does not support adding. A subclass must implement the abstract methods iterator() and size().
| Constructor Summary | |
|---|---|
protected |
AbstractCollection()
Constructs a new instance of this AbstractCollection. |
| Method Summary | |
|---|---|
boolean |
add(Object object)
If the specified element is not contained within this collection, and addition of this element succeeds, then true will be returned. |
boolean |
addAll(Collection collection)
Adds the objects in the specified Collection to this Collection. |
void |
clear()
Removes all the elements in this collection. |
boolean |
contains(Object object)
Searches this Collection for the specified object. |
boolean |
containsAll(Collection collection)
Searches this Collection for all objects in the specified Collection. |
boolean |
isEmpty()
Returns true if the collection has no element, otherwise false. |
abstract Iterator |
iterator()
Answers an Iterator on the elements of this Collection. |
boolean |
remove(Object object)
Removes the first occurrence of the specified object from this Collection. |
boolean |
removeAll(Collection collection)
Removes all occurrences in this Collection of each object in the specified Collection. |
boolean |
retainAll(Collection collection)
Removes all objects from this Collection that are not contained in the specified Collection. |
abstract int |
size()
Answers the number of elements in this Collection. |
Object[] |
toArray()
Answers a new array containing all elements contained in this Collection. |
Object[] |
toArray(Object[] contents)
Answers an array containing all elements contained in this Collection. |
String |
toString()
Answers the string representation of this Collection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, println |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Constructor Detail |
|---|
protected AbstractCollection()
| Method Detail |
|---|
public boolean add(Object object)
add in interface Collectionobject - the element to be added.
UnsupportedOperationException - if add operation is not supported by this class.
NullPointerException - if null is used to invoke this method, and null is not
permitted by this collection.
ClassCastException - if the class type of the specified element is not
compatible with the permitted class type.
IllegalArgumentException - if limitations of this collection prevent the specified
element from being addedpublic boolean addAll(Collection collection)
addAll in interface Collectioncollection - the Collection of objects
UnsupportedOperationException - when adding to this Collection is not supported
NullPointerException - if null is used to invoke this methodpublic void clear()
clear in interface CollectionUnsupportedOperationException - if this operation is not implemented.Collection.isEmpty(),
Collection.size()public boolean contains(Object object)
contains in interface Collectionobject - the object to search for
object is an element of this Collection,
false otherwisepublic boolean containsAll(Collection collection)
containsAll in interface Collectioncollection - the Collection of objects
NullPointerException - if null is used to invoke this methodpublic boolean isEmpty()
isEmpty in interface CollectionCollection.size()public abstract Iterator iterator()
iterator in interface Iterableiterator in interface CollectionIteratorpublic boolean remove(Object object)
remove in interface Collectionobject - the object to remove
UnsupportedOperationException - when removing from this Collection is not supportedpublic boolean removeAll(Collection collection)
removeAll in interface Collectioncollection - the Collection of objects to remove
UnsupportedOperationException - when removing from this Collection is not supported
NullPointerException - if null is used to invoke this methodpublic boolean retainAll(Collection collection)
retainAll in interface Collectioncollection - the Collection of objects to retain
UnsupportedOperationException - when removing from this Collection is not supported
NullPointerException - if null is used to invoke this methodpublic abstract int size()
size in interface Collectionpublic Object[] toArray()
toArray in interface Collectionpublic Object[] toArray(Object[] contents)
toArray in interface Collectioncontents - the array
ArrayStoreException - when the type of an element in this Collection cannot be
stored in the type of the specified array
NullPointerException - if null is used to invoke this methodpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||