Share via


Set.getEnumerator Method

Creates an enumerator for a set, which allows you to traverse the set.

Syntax

public SetEnumerator getEnumerator()

Run On

Called

Return Value

Type: SetEnumerator Class
A SetEnumerator object for the current set.

Examples

The following example packs the contents of a set into a container. The getEnumerator method is used to create an enumerator for the set. Therefore, that the elements in the set can be traversed and added to the container.

public static container intSet2Con(Set _intSet) 
{ 
    SetEnumerator se; 
    container     intCon; 
    ; 
 
    if (!_intSet || !_intSet.elements()) 
    { 
        return conNull(); 
    } 
    se = _intSet.getEnumerator(); 
    while (se.moveNext()) 
    { 
        intCon += se.current(); 
    } 
    return intCon; 
}

See Also

Set Class

SetEnumerator Class