MapIterator.more Method [AX 2012]

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

public boolean more()

Run On

Called

Return Value

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

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.

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; 
}

Community Additions

ADD
Show: