MapIterator.toString Method [AX 2012]

Retrieves a textual representation of the iterator.

public str toString()

Run On

Called

Return Value

Type: str
The string that describes the iterator.

If the iterator points to the first element in the set, the string will contain an indication of this, in the form: "(begin)[value]" If the iterator does not point to an element (that is, the MapIterator.more method returns false), the string returned is: "(end)" If the iterator points to a value the string is: "[value]" where value is a string representation of the element value.

The following example iterates through an integer or class map, printing out information about each map element. It uses the MapIterator.toString method to return a textual representation of the class in each map element.

{ 
    Map iim = new Map(Types::Integer, Types::Class); 
    MapIterator it; 
  
    // Add some elements into the map 
    iim.insert(1, new query()); 
    iim.insert(2, new query()); 
    iim.insert(4, new query()); 
  
    // Create a map iterator 
    it = new MapIterator (iim); 
  
    // Go on for as long as elements are found in the map 
    while (it.more()) 
    { 
        // Print each key (1, 2, 4) 
        print it.key();  
  
        // Print text representation of each value 
        print it.value().toString();  
 
        // Fetch next element in map 
        it.next(); 
    } 
    pause; 
}

Community Additions

ADD
Show: