#include <coherence/util/Collection.hpp>
Inherits Object.
Inherited by AbstractCollection [virtual]
, List [virtual]
, NullImplementation::NullCollection [virtual]
, Set [virtual]
, and WrapperCollections::AbstractWrapperCollection [virtual]
.
A collection is a group of objects also known as elements. The following behaviors of a collection are implementation dependent:
Unless otherwise stated, collections are assumed to not support any of the above.
Public Types | |
typedef spec::Handle | Handle |
Collection Handle definition. | |
typedef spec::View | View |
Collection View definition. | |
typedef spec::Holder | Holder |
Collection Holder definition. | |
Public Member Functions | |
virtual size32_t | size () const =0 |
Return the number of elements in this collection. | |
virtual bool | isEmpty () const =0 |
Determine whether this collection contains any elements. | |
virtual bool | contains (Object::View v) const =0 |
Determine if this collection contains the specified element. | |
virtual bool | containsAll (Collection::View vCol) const =0 |
Determine if this collection contains all elements from the supplied collection. | |
virtual Iterator::Handle | iterator () const =0 |
Return an Iterator over this collection. | |
virtual Muterator::Handle | iterator ()=0 |
Return an Iterator over this collection. | |
virtual ObjectArray::Handle | toArray (ObjectArray::Handle hao=NULL) const =0 |
Return the contents of this collection as an ObjectArray. | |
virtual bool | add (Object::Holder oh)=0 |
Add the given element to this collection. | |
virtual bool | addAll (Collection::View vCol)=0 |
Add all elements from the supplied collection to this collection. | |
virtual bool | remove (Object::View v)=0 |
Remove the supplied element from this collection. | |
virtual bool | removeAll (Collection::View vCol)=0 |
Remove all instances of the elements in the supplied collection from this collection. | |
virtual bool | retainAll (Collection::View vCol)=0 |
Remove all elements from this collection that are not present in the supplied collection. | |
virtual void | clear ()=0 |
Remove all elements from this collection. |
virtual size32_t size | ( | ) | const [pure virtual] |
Return the number of elements in this collection.
Implemented in AbstractCollection, CircularArrayList, DeltaSet, LinkedList, LiteSet, ReadOnlyMultiList, SafeHashMap::EntrySet, SubList, SubSet, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.
virtual bool isEmpty | ( | ) | const [pure virtual] |
Determine whether this collection contains any elements.
Implemented in AbstractCollection, LiteSet, SubSet, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.
virtual bool contains | ( | Object::View | v | ) | const [pure virtual] |
Determine if this collection contains the specified element.
v | the element to test for containment |
Implemented in AbstractCollection, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, DeltaSet, LiteSet, MapKeySet, MapValuesCollection, ReadOnlyMultiList, SafeHashMap::EntrySet, SubSet, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.
virtual bool containsAll | ( | Collection::View | vCol | ) | const [pure virtual] |
Determine if this collection contains all elements from the supplied collection.
vCol | the collection of elements to test for containment |
coherence::lang::NullPointerException | if the specified collection is NULL |
Implemented in AbstractCollection, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, LiteSet, MapKeySet, MapValuesCollection, SubSet, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.
virtual Iterator::Handle iterator | ( | ) | const [pure virtual] |
Return an Iterator over this collection.
Implemented in CircularArrayList, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, DeltaSet, LinkedList, LiteSet, MappedSet, ReadOnlyMultiList, SafeHashMap::EntrySet, SubList, SubSet, TypedCollections::TypedCollection, TypedCollections::TypedSet, TypedCollections::TypedList, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.
virtual Muterator::Handle iterator | ( | ) | [pure virtual] |
Return an Iterator over this collection.
Implemented in CircularArrayList, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, DeltaSet, LinkedList, LiteSet, MappedSet, ReadOnlyMultiList, SafeHashMap::EntrySet, SubList, SubSet, TypedCollections::TypedCollection, TypedCollections::TypedSet, TypedCollections::TypedList, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.
virtual ObjectArray::Handle toArray | ( | ObjectArray::Handle | hao = NULL |
) | const [pure virtual] |
Return the contents of this collection as an ObjectArray.
If the collection fits in the specified array, it is returned, otherwise, a new array is allocated that is the size of this collection.
If this collection fits in the array with aditional room then the element in the array immediately following the end of the collection is set to NULL. This can be useful in determining the length of this collection if the caller knows that the collection does not contain any NULL elements.
hao | an array in which to store the collection's contents |
Implemented in OldCache::KeySet, OldCache::ValuesCollection, AbstractCollection, CircularArrayList, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, DeltaSet, LiteSet, ReadOnlyMultiList, SafeHashMap::EntrySet, SubSet, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.
virtual bool add | ( | Object::Holder | oh | ) | [pure virtual] |
Add the given element to this collection.
oh | the element to add |
Implemented in AbstractCollection, CircularArrayList, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, DeltaSet, LinkedList, LiteSet, MappedSet, SubList, SubSet, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.
virtual bool addAll | ( | Collection::View | vCol | ) | [pure virtual] |
Add all elements from the supplied collection to this collection.
vCol | the collection of elements to add |
coherence::lang::NullPointerException | if the specified collection is NULL |
Implemented in AbstractCollection, CircularArrayList, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, LinkedList, LiteSet, MappedSet, SubList, SubSet, TypedCollections::TypedCollection, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.
virtual bool remove | ( | Object::View | v | ) | [pure virtual] |
Remove the supplied element from this collection.
v | the element to remove |
Implemented in AbstractCollection, CircularArrayList, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, DeltaSet, LinkedList, LiteSet, MapKeySet, MapValuesCollection, SafeHashMap::EntrySet, SubList, SubSet, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.
virtual bool removeAll | ( | Collection::View | vCol | ) | [pure virtual] |
Remove all instances of the elements in the supplied collection from this collection.
Upon completion, contains() on this collection will return false for all elements in the supplied collection.
vCol | the collection of elements to remove |
coherence::lang::NullPointerException | if the specified collection is NULL |
Implemented in AbstractCollection, CircularArrayList, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, LinkedList, LiteSet, MapKeySet, MapValuesCollection, SubSet, TypedCollections::TypedCollection, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.
virtual bool retainAll | ( | Collection::View | vCol | ) | [pure virtual] |
Remove all elements from this collection that are not present in the supplied collection.
vCol | the collection of elements to retain |
coherence::lang::NullPointerException | if the specified collection is NULL |
Implemented in AbstractCollection, CircularArrayList, CircularArrayList::SubCircularArrayList, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, LinkedList, LinkedList::SubLinkedList, LiteSet, MapKeySet, MapValuesCollection, SubSet, TypedCollections::TypedCollection, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.