public abstract static class BooleanIterators.AbstractIndexBasedListIterator extends BooleanIterators.AbstractIndexBasedIterator implements BooleanListIterator
This class is only appropriate for sequences that are at most Integer.MAX_VALUE long.
If your backing data store can be bigger then this, consider the equivalently named class in
the type specific BigListSpliterators class.
As the abstract methods in this class are used in inner loops, it is generally a
good idea to override the class as final as to encourage the JVM to inline
them (or alternatively, override the abstract methods as final).
lastReturned, minPos, pos| Modifier | Constructor and Description |
|---|---|
protected |
AbstractIndexBasedListIterator(int minPos,
int initialPos) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(boolean k)
Inserts the specified element into the list (optional operation).
|
protected abstract void |
add(int location,
boolean k)
Add the given item at the given index.
|
int |
back(int n)
Moves back for the given number of elements.
|
boolean |
hasPrevious() |
int |
nextIndex() |
boolean |
previousBoolean()
Returns the previous element as a primitive type.
|
int |
previousIndex() |
void |
set(boolean k)
Replaces the last element returned by
BooleanListIterator.next() or
BooleanListIterator.previous() with the specified element (optional operation). |
protected abstract void |
set(int location,
boolean k)
Sets the given item at the given index.
|
forEachRemaining, get, getMaxPos, hasNext, nextBoolean, remove, remove, skipclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, next, previous, remove, setskipprotected AbstractIndexBasedListIterator(int minPos,
int initialPos)
protected abstract void add(int location,
boolean k)
This method should also do what is needed to track the change to the BooleanIterators.AbstractIndexBasedIterator.getMaxPos().
Usually this is accomplished by having this method call the parent Collection's appropriate add
method, and having BooleanIterators.AbstractIndexBasedIterator.getMaxPos() track the parent collection's size.
Do not modify BooleanIterators.AbstractIndexBasedIterator.pos in this method; the default #add() method takes care of this.
See BooleanIterators.AbstractIndexBasedIterator.pos and BooleanIterators.AbstractIndexBasedIterator.get(int) for discussion on what the location means.
protected abstract void set(int location,
boolean k)
See BooleanIterators.AbstractIndexBasedIterator.pos and BooleanIterators.AbstractIndexBasedIterator.get(int) for discussion on what the location means.
public boolean hasPrevious()
hasPrevious in interface it.unimi.dsi.fastutil.BidirectionalIterator<java.lang.Boolean>hasPrevious in interface java.util.ListIterator<java.lang.Boolean>public boolean previousBoolean()
BooleanBidirectionalIteratorpreviousBoolean in interface BooleanBidirectionalIteratorListIterator.previous()public int nextIndex()
nextIndex in interface java.util.ListIterator<java.lang.Boolean>public int previousIndex()
previousIndex in interface java.util.ListIterator<java.lang.Boolean>public void add(boolean k)
BooleanListIteratorThis default implementation just throws an UnsupportedOperationException.
add in interface BooleanListIteratork - the element to insert.ListIterator.add(Object)public void set(boolean k)
BooleanListIteratorBooleanListIterator.next() or
BooleanListIterator.previous() with the specified element (optional operation).set in interface BooleanListIteratork - the element used to replace the last element returned.
This default implementation just throws an UnsupportedOperationException.
ListIterator.set(Object)public int back(int n)
BooleanBidirectionalIteratorThe effect of this call is exactly the same as that of
calling BooleanBidirectionalIterator.previous() for n times (possibly stopping
if BidirectionalIterator.hasPrevious() becomes false).
back in interface BooleanBidirectionalIteratorback in interface it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator<java.lang.Boolean>n - the number of elements to skip back.BooleanBidirectionalIterator.previous()