public interface WritableIntListIterator extends IntListIterator
IntIterator.Single
EMPTY
Modifier and Type | Method and Description |
---|---|
int |
get(int offset)
Returns the value at a position relative to the current position.
|
boolean |
hasValue() |
int |
index() |
void |
move(int offset)
Changes the current position of the iterator.
|
void |
remove()
Removes an element at the current iterator position.
|
void |
removeRange(int fromOffset,
int toOffset)
Removes a number of items from the collection.
|
void |
set(int offset,
int value)
Will set the value in the list at a position relative to the current position.
|
int |
value() |
hasNext, nextValue
iterator
int value() throws java.util.NoSuchElementException, java.lang.IllegalStateException
value
in interface IntIterator
java.lang.IllegalStateException
- if remove()
or removeRange(int, int)
was previously called without subsequent advance.java.util.NoSuchElementException
- if iterator has never been advanced
(Iterator.next()
or IntIterator.nextValue()
have never been called)boolean hasValue()
hasValue
in interface IntIterator
false
if this iterator has never been advanced or the current value has been removed via
remove()
or removeRange(int, int)
.
In other words, returns false
if the subsequent call to value()
will throw
NoSuchElementException or IllegalStateException, otherwise true
.value()
void move(int offset) throws java.util.NoSuchElementException, java.lang.IllegalStateException
IntListIterator
move
in interface IntListIterator
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.lang.IllegalStateException
- if remove()
or removeRange(int, int)
was previously called without subsequent advance.java.util.NoSuchElementException
int get(int offset) throws java.util.NoSuchElementException, java.lang.IllegalStateException
IntListIterator
get(0) will return the same value as value(), get(-1) will return value at index()-1, etc.
get
in interface IntListIterator
java.lang.IllegalStateException
- if remove()
or removeRange(int, int)
was previously called without subsequent advance.java.util.NoSuchElementException
int index() throws java.util.NoSuchElementException, java.lang.IllegalStateException
index
in interface IntListIterator
move(p)
would change index by p
, Iterator.next()
and IntIterator.nextValue()
would change it by 1.java.lang.IllegalStateException
- if remove()
or removeRange(int, int)
was previously called without subsequent advance.java.util.NoSuchElementException
- if iterator has never been advanced
(Iterator.next()
or IntIterator.nextValue()
weren't ever called)void set(int offset, int value) throws java.util.NoSuchElementException, java.lang.IllegalStateException
set(0, X) will set the value at index()
, set(-1, X) will set the value at index()-1, etc
java.lang.IllegalStateException
- if remove()
or removeRange(int, int)
was previously called without subsequent advance.java.util.NoSuchElementException
void removeRange(int fromOffset, int toOffset) throws java.util.NoSuchElementException, java.lang.IllegalStateException
After calling this method, subsequent calls to any methods except hasValue(), hasNext(), next(), and nextValue() would throw IllegalStateException until iterator is advanced. Example: removeRange(-1,2) will remove the current element, elements at index()-1 and at index()+1, and the iterator will point at the element at index()+2 after it is advanced.
java.lang.IllegalStateException
- if remove() or removeRange() was previously called without subsequent advance.java.util.NoSuchElementException
void remove() throws java.util.NoSuchElementException, java.lang.IllegalStateException
After calling this method, subsequent calls to any methods except hasValue(), hasNext(), next(), and nextValue() would throw IllegalStateException until iterator is advanced. After calling this method and subsequent advance, iterator would point at element which is next to removed one.
remove
in interface java.util.Iterator<IntIterator>
java.util.NoSuchElementException
- if iterator has never been advanced.java.lang.IllegalStateException
- if remove() or removeRange() were previously called without subsequent advance.