In case an offset parameter other than 0 is provided, the decorated iterator is immediately advanced to this position, skipping all elements before that position.
| Modifier and Type | Field and Description |
|---|---|
| private final long | offset
The offset to bound the first element return |
| private long | pos
The position of the current element |
| Access | Constructor and Description |
|---|---|
| public | SkippingIterator(final Iterator<E>
the iterator to be decorated iterator, final long the index of the first element of the decorated iterator to return offset)Decorates the specified iterator to skip all elements until the iterator
reaches the position at |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public E | next()
Overrides org. Implements java. |
| public void | remove()
Overrides org. Overrides default java. |
| offset | back to summary |
|---|---|
| private final long offset The offset to bound the first element return | |
| pos | back to summary |
|---|---|
| private long pos The position of the current element | |
| SkippingIterator | back to summary |
|---|---|
| public SkippingIterator(final Iterator<E> iterator, final long offset) Decorates the specified iterator to skip all elements until the iterator
reaches the position at
The iterator is immediately advanced until it reaches the position at
| |
| init | back to summary |
|---|---|
| private void init() Skips the given number of elements. | |
| next | back to summary |
|---|---|
| public E next() Overrides org. Implements java. Doc from org. Returns the next element in the iteration.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides org. Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
In case an offset other than 0 was specified, the underlying iterator will be advanced
to this position upon creation. A call to
| |