gnu.trove
Class TPrimitiveIterator
java.lang.Object
gnu.trove.TIterator
gnu.trove.TPrimitiveIterator
- Direct Known Subclasses:
- TDoubleDoubleIterator, TDoubleFloatIterator, TDoubleIntIterator, TDoubleIterator, TDoubleLongIterator, TDoubleObjectIterator, TFloatDoubleIterator, TFloatFloatIterator, TFloatIntIterator, TFloatIterator, TFloatLongIterator, TFloatObjectIterator, TIntDoubleIterator, TIntFloatIterator, TIntIntIterator, TIntIterator, TIntLongIterator, TIntObjectIterator, TLongDoubleIterator, TLongFloatIterator, TLongIntIterator, TLongIterator, TLongLongIterator, TLongObjectIterator
abstract class TPrimitiveIterator
- extends TIterator
Implements all iterator functions for the hashed object set.
Subclasses may override objectAtIndex to vary the object
returned by calls to next() (e.g. for values, and Map.Entry
objects).
Note that iteration is fastest if you forego the calls to
hasNext in favor of checking the size of the structure
yourself and then call next() that many times:
Iterator i = collection.iterator();
for (int size = collection.size(); size-- > 0;) {
Object o = i.next();
}
You may, of course, use the hasNext(), next() idiom too if
you aren't in a performance critical spot.
Method Summary |
protected int |
nextIndex()
Returns the index of the next value in the data structure
or a negative value if the iterator is exhausted. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_hash
protected final TPrimitiveHash _hash
- the collection on which this iterator operates.
TPrimitiveIterator
public TPrimitiveIterator(TPrimitiveHash hash)
- Creates a TPrimitiveIterator for the specified collection.
nextIndex
protected final int nextIndex()
- Returns the index of the next value in the data structure
or a negative value if the iterator is exhausted.
- Specified by:
nextIndex
in class TIterator
- Returns:
- an
int
value
- Throws:
java.util.ConcurrentModificationException
- if the underlying collection's
size has been modified since the iterator was created.