gnu.trove.impl.hash
Class THashPrimitiveIterator
- java.lang.Object
-
- gnu.trove.impl.hash.THashPrimitiveIterator
-
- All Implemented Interfaces:
- TIterator, TPrimitiveIterator
public abstract class THashPrimitiveIterator extends java.lang.Object implements TPrimitiveIterator
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.
-
-
Constructor Summary
Constructors Constructor and Description THashPrimitiveIterator(TPrimitiveHash hash)Creates a TPrimitiveIterator for the specified collection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanhasNext()Returns true if the iterator can be advanced past its current location.voidremove()Removes the last entry returned by the iterator.
-
-
-
Constructor Detail
-
THashPrimitiveIterator
public THashPrimitiveIterator(TPrimitiveHash hash)
Creates a TPrimitiveIterator for the specified collection.- Parameters:
hash- the TPrimitiveHash we want to iterate over.
-
-
Method Detail
-
hasNext
public boolean hasNext()
Returns true if the iterator can be advanced past its current location.- Specified by:
hasNextin interfaceTIterator- Specified by:
hasNextin interfaceTPrimitiveIterator- Returns:
- a
booleanvalue
-
remove
public void remove()
Removes the last entry returned by the iterator. Invoking this method more than once for a single entry will leave the underlying data structure in a confused state.- Specified by:
removein interfaceTIterator- Specified by:
removein interfaceTPrimitiveIterator
-
-
DataMelt 3.0 © DataMelt by jWork.ORG