tango.util.collection.model.GuardIterator

interface GuardIterator(V) : Iterator!(V) #
CollectionIterator extends the standard tango.util.collection.model.Iterator interface with two additional methods.

Author:

Doug Lea @version 0.93

For an introduction to this package see Overview .

bool corrupted() [public] #
Return true if the collection that constructed this enumeration has been detectably modified since construction of this enumeration. Ability and precision of detection of this condition can vary across collection class implementations. more() is false whenever corrupted is true.

Returns:

true if detectably corrupted.
uint remaining() [public] #
Return the number of elements in the enumeration that have not yet been traversed. When corrupted() is true, this number may (or may not) be greater than zero even if more() is false. Exception recovery mechanics may be able to use this as an indication that recovery of some sort is warranted. However, it is not necessarily a foolproof indication.

You can also use it to pack enumerations into arrays. For example:

 Object arr[] = new Object[e.numberOfRemainingElement()]
 int i = 0;
 while (e.more()) arr[i++] = e.value();
 

For the converse case,

See Also:

tango.util.collection.iterator.ArrayIterator.ArrayIterator

Returns:

the number of untraversed elements