Share via


Map.toString Method

Returns a description of the (key, value) pairs in the map.

Syntax

public str toString()

Run On

Called

Return Value

Type: str
A string that contains a description of the elements in the map.

Examples

The following example creates a map, adds some elements to it, and then prints a description of these elements.

{ 
    Map myMap = new Map(Types::Integer, Types::String); 
  
    // 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"); 
  
    print myMap.toString(); 
    pause; 
}

See Also

Map Class

Map.definitionString Method