MapIterator.more Method

Determines whether the iterator finds a valid (key, value) pair.

Syntax

public boolean more()

Run On

Called

Return Value

Type: boolean
true if more (key, value) pairs are available in the map; otherwise, false.

Remarks

Attempting to access an element that is pointed to by an iterator when the more method returns false will result in an error.

The more method will only test whether the iterator points to a valid element - it will not test whether there are more elements in the map.

Examples

The following example iterates through a map, by using the more method to check if there are still elements in the map. It then returns a description of all the elements in the map.

static str writeMap (Map m) 
{ 
    MapIterator it = new MapIterator(m); 
    str result; 
  
    while (it.more()) 
    { 
        result += it.key() + '\n' + it.value() + '\n'; 
        it.next(); 
    } 
    return result; 
}

See Also

MapIterator Class

MapIterator.next Method