Share via


MapEnumerator.toString Method

Returns a string that represents the current object.

Syntax

public str toString()

Run On

Called

Return Value

Type: str
A string that represents the current object.

Remarks

The default implementation returns the class name of the object. The method can be overridden in a derived class to return values that are meaningful for that type. For example, an instance of the SysMethodInfo class returns the method name and type of the method, such as instance or static.

Examples

The following example creates a map, and then prints the content of the first and second elements in the map.

{ 
    Map myMap = new Map(Types::Integer, Types::String); 
    MapEnumerator  enumerator; 
    int i; 
  
     // Add some elements to the map 
    myMap.insert(1, "Element one"); 
    myMap.insert(2, "Element two"); 
    myMap.insert(3, "Element three"); 
    myMap.insert(4, "Element Four"); 
  
    // Set the enumerator 
    enumerator = myMap.getEnumerator(); 
    // Go to beginning of enumerator 
    enumerator.reset(); 
  
    // Go to the first element in the map 
    enumerator.moveNext(); 
    // Print first item in the map 
    print enumerator.toString(); 
    // go to second element 
     enumerator.moveNext(); 
    // Print second element in map 
    print enumerator.toString(); 
    pause; 
}

See Also

MapEnumerator Class

MapEnumerator.definitionString Method