public class LongListIndexedIterator extends AbstractLongIteratorWithFlag implements LongListIterator
LongIterator.Single
myIterated
EMPTY
Constructor and Description |
---|
LongListIndexedIterator(LongList source,
IntListIterator indexIterator) |
Modifier and Type | Method and Description |
---|---|
long |
get(int relativeOffset)
Returns the value at a position relative to the current position.
|
boolean |
hasNext() |
int |
index() |
void |
move(int offset)
Changes the current position of the iterator.
|
protected void |
nextImpl()
Called before any call to
AbstractLongIteratorWithFlag.valueImpl() , should be used to either initialize the state or advance the iterator. |
protected long |
valueImpl()
Called after any call to
AbstractLongIteratorWithFlag.nextImpl() , should return value of iterator. |
hasValue, next, value
iterator, nextValue, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasValue, nextValue, value
iterator
public LongListIndexedIterator(LongList source, IntListIterator indexIterator)
public boolean hasNext()
hasNext
in interface LongIterator
hasNext
in interface java.util.Iterator<LongIterator>
true
if next call to Iterator.next()
or LongIterator.nextValue()
won't throw NoSuchElementExceptionpublic void move(int offset) throws java.util.ConcurrentModificationException, java.util.NoSuchElementException
LongListIterator
move
in interface LongListIterator
offset
- the difference between new and old iterator indices.
Zero won't change iterator state. Positive value will move it to greater indices, negative - to smaller indices.java.util.ConcurrentModificationException
java.util.NoSuchElementException
public long get(int relativeOffset) throws java.util.NoSuchElementException
LongListIterator
get(0) will return the same value as value(), get(-1) will return value at index()-1, etc.
get
in interface LongListIterator
java.util.NoSuchElementException
public int index() throws java.util.NoSuchElementException
index
in interface LongListIterator
move(p)
would change index by p
, Iterator.next()
and LongIterator.nextValue()
would change it by 1.java.util.NoSuchElementException
- if iterator has never been advanced
(Iterator.next()
or LongIterator.nextValue()
weren't ever called)protected void nextImpl() throws java.util.ConcurrentModificationException, java.util.NoSuchElementException
AbstractLongIteratorWithFlag
AbstractLongIteratorWithFlag.valueImpl()
, should be used to either initialize the state or advance the iterator.nextImpl
in class AbstractLongIteratorWithFlag
java.util.ConcurrentModificationException
java.util.NoSuchElementException
protected long valueImpl() throws java.util.NoSuchElementException
AbstractLongIteratorWithFlag
AbstractLongIteratorWithFlag.nextImpl()
, should return value of iterator.
Can safely assume that the iterator is initialized.valueImpl
in class AbstractLongIteratorWithFlag
java.util.NoSuchElementException