SetIterator.value Method
Retrieves the value that the iterator is pointing to.
Syntax
public anytype value()
Run On
Called
Return Value
Type: anytype
The value denoted by the iterator.
Remarks
Use SetIterator.more to check whether an element exists before trying to retrieve the key value of the set element.
Examples
The following example uses the SetIterator.value method to print the value of the current item in the set.
{
Set s1 = new Set (Types::Integer);
SetIterator it;
// Add some elements
s1.add(3);
s1.add(4);
s1.add(13);
s1.add(1);
// Start a traversal of the elements in the set
it = new SetIterator(s1);
// Prints "(begin)[1]"
print it.toString();
// The elements are fetched in the order: 1, 3, 4, 13
while (it.more())
{
print it.value();
// Fetch the next element
it.next();
}
pause;
}