activemq-cpp-3.4.0

decaf::util::AbstractSet< E > Class Template Reference

This class provides a skeletal implementation of the Set interface to minimize the effort required to implement this interface. More...

#include <src/main/decaf/util/AbstractSet.h>

Inheritance diagram for decaf::util::AbstractSet< E >:

Public Member Functions

virtual ~AbstractSet ()
virtual bool removeAll (const Collection< E > &collection)
 Removes all this collection's elements that are also contained in the specified collection (optional operation).After this call returns, this collection will contain no elements in common with the specified collection.
Parameters:
collectionThe Collection whose elements are to be removed from this one.
Returns:
true if the collection changed as a result of this call.
Exceptions:
UnsupportedOperationExceptioif this is an unmodifiable collection.
NullPointerExceptionif the Collection is a container of pointers and does not allow NULL values.
This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's so contained, it's removed from this collection with the iterator's remove method.Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements in common with the specified collection.

Detailed Description

template<typename E>
class decaf::util::AbstractSet< E >

This class provides a skeletal implementation of the Set interface to minimize the effort required to implement this interface.

The process of implementing a set by extending this class is identical to that of implementing a Collection by extending AbstractCollection, except that all of the methods and constructors in subclasses of this class must obey the additional constraints imposed by the Set interface (for instance, the add method must not permit addition of multiple instances of an object to a set).

Since:
1.0

Constructor & Destructor Documentation

template<typename E>
virtual decaf::util::AbstractSet< E >::~AbstractSet ( ) [inline, virtual]

Member Function Documentation

template<typename E>
virtual bool decaf::util::AbstractSet< E >::removeAll ( const Collection< E > &  collection) [inline, virtual]

Removes all this collection's elements that are also contained in the specified collection (optional operation).After this call returns, this collection will contain no elements in common with the specified collection.

Parameters:
collectionThe Collection whose elements are to be removed from this one.
Returns:
true if the collection changed as a result of this call.
Exceptions:
UnsupportedOperationExceptioif this is an unmodifiable collection.
NullPointerExceptionif the Collection is a container of pointers and does not allow NULL values.
This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's so contained, it's removed from this collection with the iterator's remove method.Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements in common with the specified collection.

This implementation determines which is the smaller of this set and the specified collection, by invoking the size method on each. If this set has fewer elements, then the implementation iterates over this set, checking each element returned by the iterator in turn to see if it is contained in the specified collection. If it is so contained, it is removed from this set with the iterator's remove method. If the specified collection has fewer elements, then the implementation iterates over the specified collection, removing from this set each element returned by the iterator, using this set's remove method.

Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method.

Reimplemented from decaf::util::AbstractCollection< E >.

Reimplemented in decaf::util::concurrent::CopyOnWriteArraySet< E >.


The documentation for this class was generated from the following file: