gnu.trove
Class TObjectHashIterator

java.lang.Object
  extended bygnu.trove.TIterator
      extended bygnu.trove.THashIterator
          extended bygnu.trove.TObjectHashIterator
All Implemented Interfaces:
java.util.Iterator

class TObjectHashIterator
extends THashIterator

Created: Wed Nov 28 21:30:53 2001

Version:
$Id: TObjectHashIterator.java,v 1.1 2001/12/28 20:04:39 ericdf Exp $
Author:
Eric D. Friedman

Field Summary
protected  int _expectedSize
          the number of elements this iterator believes are in the data structure it accesses.
protected  TObjectHash _hash
           
protected  int _index
          the index used for iteration.
protected  TObjectHash _objectHash
           
 
Constructor Summary
TObjectHashIterator(TObjectHash hash)
           
 
Method Summary
 boolean hasNext()
          Returns true if the iterator can be advanced past its current location.
protected  void moveToNextIndex()
          Sets the internal index so that the `next' object can be returned.
 java.lang.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  java.lang.Object objectAtIndex(int index)
          Returns the object at the specified index.
 void remove()
          Removes the last entry returned by the iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Iterator
hasNext, remove
 

Field Detail

_objectHash

protected final TObjectHash _objectHash

_hash

protected final TObjectHash _hash

_expectedSize

protected int _expectedSize
the number of elements this iterator believes are in the data structure it accesses.


_index

protected int _index
the index used for iteration.

Constructor Detail

TObjectHashIterator

public TObjectHashIterator(TObjectHash hash)
Method Detail

objectAtIndex

protected java.lang.Object objectAtIndex(int index)
Description copied from class: THashIterator
Returns the object at the specified index. Subclasses should implement this to return the appropriate object for the given index.

Specified by:
objectAtIndex in class THashIterator
Parameters:
index - the index of the value to return.
Returns:
an Object value

next

public java.lang.Object next()
Moves the iterator to the next Object and returns it.

Specified by:
next in interface java.util.Iterator
Returns:
an Object value
Throws:
java.util.ConcurrentModificationException - if the structure was changed using a method that isn't on this iterator.
java.util.NoSuchElementException - if this is called on an exhausted iterator.

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.

hasNext

public boolean hasNext()
Returns true if the iterator can be advanced past its current location.

Returns:
a boolean value

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.


moveToNextIndex

protected final void moveToNextIndex()
Sets the internal index so that the `next' object can be returned.