SetIterator Class

The SetIterator class allows you to iterate over the elements in a set.


class SetIterator extends Object

Run On



  Method Description
Gg957740.pubmethod(en-us,AX.60).gif begin Moves the iterator to the start of the set.
Gg957740.pubmethod(en-us,AX.60).gif cancelTimeOut Cancels a previous method call to the setTimeOut method. (Inherited from Object.)
Gg957740.pubmethod(en-us,AX.60).gif definitionString Returns a textual representation of the type of the iterator.
Gg957740.pubmethod(en-us,AX.60).gif delete Removes the element that is pointed to by the iterator of the set.
Gg957740.pubmethod(en-us,AX.60).gif end Moves the iterator past the last element in the set.
Gg957740.pubmethod(en-us,AX.60).gif equal Determines whether the specified object is equal to the current one. (Inherited from Object.)
Gg957740.pubmethod(en-us,AX.60).gif getTimeOutTimerHandle Returns the timer handle for the object. (Inherited from Object.)
Gg957740.pubmethod(en-us,AX.60).gif handle Retrieves the handle of the class of the object. (Inherited from Object.)
Gg957740.pubmethod(en-us,AX.60).gif more Determines whether the iterator denotes a valid set element.
Gg957740.pubmethod(en-us,AX.60).gif new Creates a new iterator for a set. (Overrides the new Method.)
Gg957740.pubmethod(en-us,AX.60).gif next Moves the iterator to the next element.
Gg957740.pubmethod(en-us,AX.60).gif notify Releases the hold on an object that has called the wait method on this object. (Inherited from Object.)
Gg957740.pubmethod(en-us,AX.60).gif notifyAll Releases a lock on the object that was issued by the wait method on this object. (Inherited from Object.)
Gg957740.pubmethod(en-us,AX.60).gif objectOnServer Determines whether the object is on a server. (Inherited from Object.)
Gg957740.pubmethod(en-us,AX.60).gif owner Returns the instance that owns the object. (Inherited from Object.)
Gg957740.pubmethod(en-us,AX.60).gif setTimeOut Sets up the scheduled execution of a specified method. (Inherited from Object.)
Gg957740.pubmethod(en-us,AX.60).gif toString Returns a textual representation of the current element in the set that is pointed to by the iterator. (Overrides the toString Method.)
Gg957740.pubmethod(en-us,AX.60).gif usageCount Returns the current number of references, that is, the value of the reference counter, that the object has. (Inherited from Object.)
Gg957740.pubmethod(en-us,AX.60).gif value Retrieves the value that the iterator is pointing to.
Gg957740.pubmethod(en-us,AX.60).gif wait Pauses a process. (Inherited from Object.)
Gg957740.pubmethod(en-us,AX.60).gif xml Returns an XML string that represents the current object. (Inherited from Object.)



Set iterators may be viewed as pointers into the sets over which they iterate. Functionality is available to start the iteration, to determine whether more elements are available, and to fetch the element pointed to by the iterator.

Newly created set iterators are positioned at the first element in the set. The order in which the elements occur during iteration is defined not by the sequence in which the elements are inserted, but by the ordering of the elements. Elements with lower values appear before elements with higher values. The usual ordering for the types is used. If the constituent elements are objects; however, the addresses of the objects are used to supply the ordering. No specific ordering may consequently be inferred. The addresses of the objects are transient by nature.

It is best practice to use the class instead of the SetIterator class. This avoids problems if you are accessing the set on one tier with an iterator on another tier. Set iterators and the sets over which they iterate must be on the same client/server side. If you use SetIterator and code is marked as Called from, it is possible that the set and the iterator will end up on different tiers, and the code will fail. If you use SetEnumerator, the enumerator is automatically created on the same tier as the set. Also, to move to the next item in a set, you must explicitly call the more and next methods if you are using a set iterator. If you use SetEnumerator, you only have to call moveNext method.


The following example creates a set of integers and then adds four values to it. It then iterates through the set that is printing out information about each set element.

    Set s1 = new Set (Types::Integer); 
    int theElement; 
    SetIterator it; 
    // Add some elements. 
    // Start a traversal of the elements in the set. 
    it = new SetIterator(s1); 
    // Prints "(begin)[1]". 
    print it.toString(); 
    // The elements are fetched in the order: 1, 3, 4, 13. 
    while (it.more()) 
        theElement = it.value(); 
        print theElement; 
         // Fetch the next element.; 

Inheritance Hierarchy

Object Class
  SetIterator Class
    InventDimOnHandIterator Class

See Also

Set Class

SetEnumerator Class