ListEnumerator.reset Method

Moves the enumerator to the start of the list.

Syntax

public void reset()

Run On

Called

Remarks

The reset method moves the enumerator to the start of the list, before the first element in the list. You must call the ListEnumerator.moveNext method to make it point to the first element in the list.

Examples

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

{ 
    List list = new List(Types::Integer); 
    ListEnumerator  enumerator; 
  
    // Add some elements to the list 
    list.addEnd(1); 
    list.addEnd(2); 
    list.addStart(3); 
  
    // Set the enumerator 
    enumerator = list.getEnumerator(); 
  
    // Go to beginning of enumerator 
    enumerator.reset(); 
  
    //Go to the first element in the List 
    enumerator.moveNext(); 
  
    // First element is 3 as this was added to start of list 
    print enumerator.toString(); 
    pause; 
}

See Also

Reference

ListEnumerator Class