Package gnu.trove
Class TLongIterator
java.lang.Object
gnu.trove.TLongIterator
Iterator for long collections.
- Version:
- $Id: PIterator.template,v 1.1 2006/11/10 23:28:00 robeden Exp $
- Author:
- Eric D. Friedman
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
the number of elements this iterator believes are in the data structure it accesses.protected int
the index used for iteration. -
Constructor Summary
ConstructorsConstructorDescriptionTLongIterator
(TLongHash hash) Creates a TLongIterator for the elements in the specified collection. -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
Returns true if the iterator can be advanced past its current location.protected final void
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 final int
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.
-
Field Details
-
_expectedSize
protected int _expectedSizethe number of elements this iterator believes are in the data structure it accesses. -
_index
protected int _indexthe index used for iteration.
-
-
Constructor Details
-
TLongIterator
Creates a TLongIterator for the elements in the specified collection.
-
-
Method Details
-
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
-
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.- Returns:
- an
int
value - Throws:
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.
-