Package com.tangosol.util
Class PrimitiveSparseArray.Iterator
- java.lang.Object
-
- com.tangosol.util.AbstractSparseArray.Crawler
-
- com.tangosol.util.PrimitiveSparseArray.Iterator
-
- All Implemented Interfaces:
LongArray.Iterator<Long>
,Cloneable
,Iterator<Long>
- Enclosing class:
- PrimitiveSparseArray
public class PrimitiveSparseArray.Iterator extends AbstractSparseArray.Crawler implements LongArray.Iterator<Long>
Iterator over long values stored in the tree.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Iterator(AbstractSparseArray.Node head, int fromdir, boolean fForward)
Instantiate a new PrimitiveIterator at the specified location and direction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getPrimitiveValue()
Returns the current value, which is the same value returned by the most recent call to the nextPrimitive method, or the most recent value passed to setPrimitiveValue if setPrimitiveValue were called after the nextPrimitive method.long
nextPrimitive()
Returns the next element (as a long) in the iteration.long
setPrimitiveValue(long lValue)
Stores a new value at the current value index, returning the value that was replaced.-
Methods inherited from class com.tangosol.util.AbstractSparseArray.Crawler
clone, currentNode, getIndex, getValue, hasNext, next, nextNode, remove, setValue, toString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
Iterator
protected Iterator(AbstractSparseArray.Node head, int fromdir, boolean fForward)
Instantiate a new PrimitiveIterator at the specified location and direction.- Parameters:
head
- the node at which to start the crawlfromdir
- the direction in which to start the crawl
-
-
Method Detail
-
nextPrimitive
public long nextPrimitive()
Returns the next element (as a long) in the iteration.- Returns:
- the next element (as a long) in the iteration
- Throws:
NoSuchElementException
- iteration has no more elements
-
getPrimitiveValue
public long getPrimitiveValue()
Returns the current value, which is the same value returned by the most recent call to the nextPrimitive method, or the most recent value passed to setPrimitiveValue if setPrimitiveValue were called after the nextPrimitive method.- Returns:
- the current value
- Throws:
IllegalStateException
- if the next method has not yet been called, or the remove method has already been called after the last call to the next method.
-
setPrimitiveValue
public long setPrimitiveValue(long lValue)
Stores a new value at the current value index, returning the value that was replaced. The index of the current value is obtainable by calling the getIndex method.- Returns:
- the replaced value
- Throws:
IllegalStateException
- if the next method has not yet been called, or the remove method has already been called after the last call to the next method.
-
-