GNU Trove

gnu.trove
Class TLongIterator

java.lang.Object
  |
  +--gnu.trove.TIterator
        |
        +--gnu.trove.TPrimitiveIterator
              |
              +--gnu.trove.TLongIterator

public class TLongIterator
extends gnu.trove.TPrimitiveIterator

Iterator for long collections.

Version:
$Id: TLongIterator.java,v 1.2 2003/03/19 04:41:29 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  TPrimitiveHash _hash
          the collection on which this iterator operates.
protected  int _index
          the index used for iteration.
 
Constructor Summary
TLongIterator(TLongHash hash)
          Creates a TLongIterator for the elements in the specified collection.
 
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.
 long next()
          Advances the iterator to the next element in the underlying collection 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.
 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
 

Field Detail

_hash

protected final TPrimitiveHash _hash
the collection on which this iterator operates.


_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

TLongIterator

public TLongIterator(TLongHash hash)
Creates a TLongIterator for the elements in the specified collection.

Method Detail

next

public long next()
Advances the iterator to the next element in the underlying collection and returns it.

Returns:
the next long in the collection
Throws:
NoSuchElementException - if the iterator is already exhausted

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 gnu.trove.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.


GNU Trove

GNU Trove is copyright 2001-2003 Eric D. Friedman. All Rights Reserved.