MapIterator.more Method

Definition

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

public:
 virtual bool more();
public virtual bool more ();
abstract member more : unit -> bool
override this.more : unit -> bool
Public Overridable Function more () As Boolean

Returns

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

Remarks

If you try to access an element that is pointed to by an iterator when the more method returns false, you receive an error. The more method only tests whether the iterator points to a valid element. It does not test whether there are more elements in the map.

The following example iterates through a map by using the more method to check whether 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; 
}

Applies to