Share via


MapIterator.value Method

Returns the value from the (key, value) pair referred to by the iterator.

Syntax

public anytype value()

Run On

Called

Return Value

Type: anytype
The value from the map element denoted by the map iterator.

Remarks

Use the MapIterator.more method to test whether an element exists before trying to retrieve the key value of the map element.

Examples

The following example iterates through a map and returns a list 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.key Method