### IAKeySet

  A key set is an unordered collection of zero or more elements that have a key. Element equality is not supported. Only unique elements are supported, in terms of their key.

### IAKeySet - Member Functions and Data by Group

### Constructors & Destructor

Construct and destruct an IAKeySet object.

~IAKeySet

      public:
      ~IAKeySet()

  Removes all elements from the collection. Destructors are called for all elements contained in the collection and for elements that have been constructed in advance.

  Side Effects

  All cursors of the collection become undefined.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IAKeySet

  Overload 1

      public:
      IAKeySet(INotifier&)

  Use this constructor to create a collection with support for notification.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      protected:
      IAKeySet(IAKeySet < Element, Key > const&)

  Constructs a collection. The collection is unbounded and is initially empty.
  Note: The collection constructor does not define whether any elements are constructed when the collection is constructed. For some classes, the element's default constructor may be invoked when the collection's constructor is invoked. This happens if a tabular or a diluted sequence implementation variant is used for a collection. The element's default constructor is used to allocate the required storage and initialize the elements. Therefore, a default constructor must be available for elements in such cases.

  Exception

  IOutOfMemory

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 3

      protected:
      IAKeySet()

  This is the default constructor.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Key Operations

Locate elements with a particular key, find out how many different keys are available, or remove all elements with a particular key.

numberOfDifferentKeys

      protected:
      INumber numberOfDifferentKeys() const

  Returns the number of different keys in the collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

numberOfElementsWithKey

      protected:
      INumber numberOfElementsWithKey(Key const&) const

  Returns the number of elements in the collection with the given key.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

removeAllElementsWithKey

      protected:
      INumber removeAllElementsWithKey(Key const&)

  Removes all elements from the collection with the same key as the given key. Element destructors are called as described in IACollection::removeAt.

  Side Effects

  If any elements were removed, all cursors of this collection become undefined.

  Return Value

  The number of elements removed.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Location and Iteration

Locate elements that match or do not match a particular key.

locateNextElementWithKey

      protected:
      bool locateNextElementWithKey(Key const&, ICursor&) const

  Locates the next element in iteration order in the collection with the given key, starting at the element next to the one pointed to by the given cursor. Sets the cursor to point to the element in the collection. The cursor is invalidated if the end of the collection is reached and no more occurrences of such an element are left to be visited.
  Note: If you code a call to IAEqualitySequence::locateFirstand a set of calls to IAPriorityQueue::locateNextElementWithKey, each occurrence of an element will be visited exactly once in iteration order.

  Preconditions

  The cursor must belong to the collection and must point to an element of the collection.

  Return Value

  Returns true if an element was found.

  Exception

  ICursorInvalidException

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setToNextWithDifferentKey

      protected:
      bool setToNextWithDifferentKey(ICursor&) const

  Sets the cursor to the next element in the collection in iteration order with a key different from the key of the element pointed to by the given cursor. If no such element exists, the given cursor is no longer valid.

  Preconditions

  The cursor must belong to the collection and must point to an element of the collection.

  Return Value

  Returns true if a subsequent element was found whose key is different from the current key.

  Exception

  ICursorInvalidException

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IAKeySet - Inherited Member Functions and Data

#### Inherited Public Functions

  IACollection

  -     virtual ~IACollection()

  -     virtual bool add(Element const&, ICursor&)

  -     virtual bool add(Element const&)

  -     virtual void addAllFrom(IACollection < Element > const&)

  -     void adoptStreamer(IACollectionStreamer*)

  -     bool allElementsDo(IApplicator < Element >&)

  -     bool allElementsDo(IConstantApplicator < Element >&) const

  -     bool
          allElementsDo( bool ( * applicatorFunction ) ( Element const&,
                         void * ) , void* additionalArgument = 0 ) const

  -     bool
          allElementsDo( bool ( * applicatorFunction ) ( Element&,
                         void * ) , void* additionalArgument = 0 )

  -     Element const& any() const

  -     Element const& anyElement() const

  -     virtual void copy(IACollection < Element > const&)

  -     INotifier& disableNotification()

  -     Element const& elementAt(ICursor const&) const

  -     Element& elementAt(ICursor const&)

  -     INotifier& enableNotification(bool = true)

  -     IACollection(INotifier&)

  -     bool isBounded() const

  -     bool isConsistent() const

  -     bool isEmpty() const

  -     bool isEnabledForNotification() const

  -     bool isFull() const

  -     INumber maxNumberOfElements() const

  -     virtual ICursor* newCursor() const

  -     ICursor* newMngCursor() const

  -     INotifier& notifier()

  -     INotifier const& notifier() const

  -     INotifier& notifyObservers(INotificationEvent const&)

  -     INumber numberOfElements() const

  -     virtual void operator <<=(IDataStream&)

  -     virtual void operator >>=(IDataStream&)

  -     operator INotifier &() const

  -     virtual INumber
          removeAll( bool ( * predicateFunction ) ( Element const&,
                     void * ) , void* additionalArgument = 0 )

  -     virtual INumber removeAll()

  -     virtual void removeAt(ICursor&)

  -     virtual void replaceAt(ICursor const&, Element const&)

  -     bool setToFirst(ICursor&) const

  -     bool setToNext(ICursor&) const

  IAKeyCollection

  -     ~IAKeyCollection()

  -     virtual bool addOrReplaceElementWithKey(Element const&)

  -     virtual bool
          addOrReplaceElementWithKey( Element const&,
                                      ICursor& )

  -     bool
          containsAllKeysFrom( IACollection < Element > const& ) const

  -     bool containsElementWithKey(Key const&) const

  -     Element const& elementWithKey(Key const&) const

  -     Element& elementWithKey(Key const&)

  -     IAKeyCollection(INotifier&)

  -     Key const& key(Element const&) const

  -     bool locateElementWithKey(Key const&, ICursor&) const

  -     virtual bool locateOrAddElementWithKey(Element const&)

  -     virtual bool
          locateOrAddElementWithKey( Element const&,
                                     ICursor& )

  -     virtual INumber removeAllElementsWithKey(Key const&)

  -     virtual bool removeElementWithKey(Key const&)

  -     virtual bool
          replaceElementWithKey( Element const&,
                                 ICursor& )

  -     virtual bool replaceElementWithKey(Element const&)

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  IACollectionBase

  -     ~IACollectionBase()

  -     static ICursorImpl& CrsrImplOf(ICursor& cursor)

  -     static ICursorImpl const& CrsrImplOf(ICursor const& cursor)

  -     IACollectionBase()

  -     IACollectionBase(IACollectionBase const&)

  -     static ICursor* InterfaceFor(ICursorImpl* cursor)

  IACollection

  -     IACollection(IACollection < Element > const&)

  -     IACollection()

  -     static Implementation&
          ImplOf( IACollection < Element > const& )

  IAKeyCollection

  -     IAKeyCollection(IAKeyCollection < Element, Key > const&)

  -     IAKeyCollection()

#### Inherited Protected Data

  - None