ListIterator.more Method

Determines whether the list iterator points to a valid element.

Syntax

public boolean more()

Run On

Called

Return Value

Type: boolean
true if the list iterator points to a valid element; otherwise, false.

Remarks

Attempting to access an element when this method returns false will cause an error.

Examples

The following example uses the ListIterator.more method to check whether there are more elements in the list and then runs through the while loop, which prints the values of all the elements in the list.

{ 
    List il = new List(Types::Integer); 
    ListIterator it; 
    int i; 
  
    // Add some elements 
    for (i = 1; i <= 10; i++) 
    { 
        il.addEnd(i); 
    } 
  
    // Traverse the list 
    it = new ListIterator(il); 
    while (it.more()) 
    { 
        print it.value(); 
        it.next(); // Skip to the next element 
    } 
    pause; 
}

See Also

ListIterator Class

ListIterator.next Method