AbstractSet Class Reference

#include <coherence/util/AbstractSet.hpp>

Inherits AbstractCollection, and Set.

Inherited by NullImplementation::NullSet.

List of all members.


Detailed Description

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

Author:
js 2008.05.12

Public Types

typedef spec::Handle Handle
 AbstractSet Handle definition.
typedef spec::View View
 AbstractSet View definition.
typedef spec::Holder Holder
 AbstractSet Holder definition.

Public Member Functions

virtual bool equals (Object::View v) const
 Compare the specified object with this set for equality.

Return true if the specified object is also a set, the two sets have the same size, and every member of the specified set is contained in this set (or equivalently, every member of this set is contained in the specified set). This definition ensures that the equals() method works properly across different implementations of the Set interface.

Parameters:
v Object to be compared for equality with this set.
Returns:
true iff the specified Object is equal to this set.

virtual size32_t hashCode () const
 Return the hash code value for this set.

The hash code of a set is defined to be the sum of the hash codes of the elements in the set, where the hashcode of a NULL element is defined to be zero. This ensures that s1->equals(s2) implies that s1->hashCode() == s2->hashCode() for any two sets s1 and s2, as required by the general contract of Object::hashCode().

Returns:
the hash code value for this set.


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