activemq-cpp-3.4.0
|
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>
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.
|
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).
virtual decaf::util::AbstractSet< E >::~AbstractSet | ( | ) | [inline, virtual] |
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.
collection | The Collection whose elements are to be removed from this one. |
UnsupportedOperationExceptio | if this is an unmodifiable collection. |
NullPointerException | if the Collection is a container of pointers and does not allow NULL values. |
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 >.