Set Class Reference

#include <coherence/util/Set.hpp>

Inherits Collection.

Inherited by AbstractSet [virtual], SafeHashMap::EntrySet [virtual], and WrapperCollections::AbstractWrapperSet [virtual].

List of all members.

Detailed Description

A collection that contains no duplicate elements.

As implied by its name, this interface models the mathematical set abstraction.

The Set interface places additional stipulations on the contracts of all constructors of the Set implementations and on the contracts of the add and equals methods.

The additional stipulation on constructors is, not surprisingly, that all constructors must create a set that contains no duplicate elements.

See also:

Public Types

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

Public Member Functions

virtual bool equals (Object::View v) const =0
 Compare the specified object with this set for equality.
virtual size32_t hashCode () const =0
 Return the hash code value for this set.

Member Function Documentation

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

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.

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

Implemented in AbstractSet, ConverterCollections::ConverterSet, SafeHashMap::EntrySet, and WrapperCollections::AbstractWrapperSet.

virtual size32_t hashCode (  )  const [pure virtual]

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

the hash code value for this set.

Reimplemented from Object.

Implemented in AbstractSet, SafeHashMap::EntrySet, and WrapperCollections::AbstractWrapperSet.

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