gnu.trove
abstract class THashIterator extends TIterator implements Iterator
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.
Field Summary | |
---|---|
protected TObjectHash | _hash |
Constructor Summary | |
---|---|
THashIterator(TObjectHash hash)
Create an instance of THashIterator over the values of the TObjectHash |
Method Summary | |
---|---|
Object | next()
Moves the iterator to the next Object and returns it.
|
protected int | nextIndex()
Returns the index of the next value in the data structure
or a negative value if the iterator is exhausted.
|
protected abstract Object | objectAtIndex(int index)
Returns the object at the specified index. |
Returns: an Object
value
Throws: ConcurrentModificationException if the structure was changed using a method that isn't on this iterator. NoSuchElementException if this is called on an exhausted iterator.
Returns: an int
value
Throws: ConcurrentModificationException if the underlying collection's size has been modified since the iterator was created.
Parameters: index the index of the value to return.
Returns: an Object
value