Set.elements Method

Returns the number of elements in the set.

Syntax

public int elements()

Run On

Called

Return Value

Type: int
The number of elements in the set.

Examples

The following example packs the contents of a set into a container. The elements method is used to test whether the set has any contents. If there are no contents, a null Nothing nullptr unit a null reference (Nothing in Visual Basic) container is returned.

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

Reference

Set Class