SetEnumerator.reset Method

Moves the enumerator to the start of the set.

Syntax

public void reset()

Run On

Called

Remarks

The reset method moves the enumerator to the start of the set, in front of the first element in the set. You must call the SetEnumerator.moveNext method to make it point to the first element in the set.

Examples

The following example creates a set and then creates an enumerator for the set. It uses the reset method to move to the start of the set and then uses the moveNext method to move to the first element in the set.

{ 
    Set mySet = new Set(Types::Integer); 
    SetEnumerator  enumerator; 
    int i; 
  
     // Add some elements to the set. 
    for (i = 0; i < 10; i++) 
    { 
        mySet.add(i); 
    } 
    // Set the enumerator. 
    enumerator = mySet.getEnumerator(); 
    // Go to beginning of enumerator. 
    enumerator.reset(); 
  
    // Go to the first element in the set. 
    enumerator.moveNext(); 
    // Print the first item in the set. 
    print enumerator.toString(); 
    pause; 
}

See Also

Reference

SetEnumerator Class