Collection Class Reference

#include <coherence/util/Collection.hpp>

Inherits Object.

Inherited by AbstractCollection [virtual], List [virtual], NullImplementation::NullCollection [virtual], Set [virtual], and WrapperCollections::AbstractWrapperCollection [virtual].

List of all members.


Detailed Description

The base interface of all collections managed by Coherence.

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.

See also:
Iterator

List

Map

Set

Author:
jh/mf/nsa 2008.01.28

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 () 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.

Member Function Documentation

virtual size32_t size (  )  const [pure virtual]

Return the number of elements in this collection.

Returns:
the number of elements in this collection

Implemented in AbstractCollection, LinkedList, SafeHashMap::EntrySet, SubList, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.

virtual bool isEmpty (  )  const [pure virtual]

Determine whether this collection contains any elements.

Returns:
true if this collection has no elements

Implemented in AbstractCollection, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.

virtual bool contains ( Object::View  v  )  const [pure virtual]

Determine if this collection contains the specified element.

Parameters:
v the element to test for containment
Returns:
true iff this collection contains the given element

Implemented in AbstractCollection, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, MapKeySet, MapValuesCollection, SafeHashMap::EntrySet, 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.

Parameters:
vCol the collection of elements to test for containment
Returns:
true iff this collection contains all elements from the supplied collection
Exceptions:
coherence::lang::NullPointerException if the specified collection is NULL
See also:
contains()

Implemented in AbstractCollection, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, MapKeySet, MapValuesCollection, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.

virtual Iterator::Handle iterator (  )  const [pure virtual]

Return an Iterator over this collection.

Returns:
an Iterator over this collection

Implemented in ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, LinkedList, MappedSet, SafeHashMap::EntrySet, SubList, 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.

Returns:
an Iterator over this collection

Implemented in ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, LinkedList, MappedSet, SafeHashMap::EntrySet, SubList, TypedCollections::TypedCollection, TypedCollections::TypedSet, TypedCollections::TypedList, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.

virtual ObjectArray::Handle toArray (  )  const [pure virtual]

Return the contents of this collection as an ObjectArray.

Returns:
a new ObjectArray containing all the elements of this collection in the same order as returned by the collection's Iterator
See also:
Iterator

Implemented in AbstractCollection, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, SafeHashMap::EntrySet, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.

virtual bool add ( Object::Holder  oh  )  [pure virtual]

Add the given element to this collection.

Parameters:
oh the element to add
Returns:
true iff this collection was modified as a result of this operation

Implemented in AbstractCollection, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, LinkedList, MappedSet, SubList, 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.

Parameters:
vCol the collection of elements to add
Returns:
true iff this collection was modified as a result of this operation
Exceptions:
coherence::lang::NullPointerException if the specified collection is NULL
See also:
add()

Implemented in AbstractCollection, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, LinkedList, MappedSet, SubList, TypedCollections::TypedCollection, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.

virtual bool remove ( Object::View  v  )  [pure virtual]

Remove the supplied element from this collection.

Parameters:
v the element to remove
Returns:
true iff this collection was modified as a result of this operation

Implemented in AbstractCollection, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, LinkedList, MapKeySet, MapValuesCollection, SafeHashMap::EntrySet, SubList, 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.

Parameters:
vCol the collection of elements to remove
Returns:
true iff this collection was modified as a result of this operation
Exceptions:
coherence::lang::NullPointerException if the specified collection is NULL
See also:
remove()

contains()

Implemented in AbstractCollection, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, LinkedList, MapKeySet, MapValuesCollection, 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.

Parameters:
vCol the collection of elements to retain
Returns:
true iff this collection was modified as a result of this operation.
Exceptions:
coherence::lang::NullPointerException if the specified collection is NULL
See also:
remove()

contains()

Implemented in AbstractCollection, ConverterCollections::ConverterCollection, ConverterCollections::ConverterSet, LinkedList, LinkedList::SubLinkedList, MapKeySet, MapValuesCollection, TypedCollections::TypedCollection, WrapperCollections::AbstractWrapperCollection, WrapperCollections::AbstractWrapperSet, and WrapperCollections::AbstractWrapperList.


The documentation for this class was generated from the following file: Copyright (c) 2000-2008 Oracle. All rights reserved.