Class BooleanIterators.AbstractIndexBasedListIterator
- All Implemented Interfaces:
it.unimi.dsi.fastutil.BidirectionalIterator<Boolean>,BooleanBidirectionalIterator,it.unimi.dsi.fastutil.booleans.BooleanIterator,BooleanListIterator,it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator<Boolean>,it.unimi.dsi.fastutil.objects.ObjectIterator<Boolean>,Iterator<Boolean>,ListIterator<Boolean>,PrimitiveIterator<Boolean,it.unimi.dsi.fastutil.booleans.BooleanConsumer>
- Enclosing class:
BooleanIterators
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).
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.PrimitiveIterator
PrimitiveIterator.OfDouble, PrimitiveIterator.OfInt, PrimitiveIterator.OfLong -
Field Summary
Fields inherited from class it.unimi.dsi.fastutil.booleans.BooleanIterators.AbstractIndexBasedIterator
lastReturned, minPos, pos -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractIndexBasedListIterator(int minPos, int initialPos) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(boolean k) Inserts the specified element into the list (optional operation).protected abstract voidadd(int location, boolean k) Add the given item at the given index.intback(int n) Moves back for the given number of elements.booleanintbooleanReturns the previous element as a primitive type.intvoidset(boolean k) Replaces the last element returned byBooleanListIterator.next()orBooleanListIterator.previous()with the specified element (optional operation).protected abstract voidset(int location, boolean k) Sets the given item at the given index.Methods inherited from class it.unimi.dsi.fastutil.booleans.BooleanIterators.AbstractIndexBasedIterator
forEachRemaining, get, getMaxPos, hasNext, nextBoolean, remove, remove, skipMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanBidirectionalIterator
skipMethods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanIterator
forEachRemaining, forEachRemaining, nextBooleanMethods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanListIterator
add, next, previous, remove, setMethods inherited from interface java.util.ListIterator
hasNext
-
Constructor Details
-
AbstractIndexBasedListIterator
protected AbstractIndexBasedListIterator(int minPos, int initialPos)
-
-
Method Details
-
add
protected abstract void add(int location, boolean k) Add the given item at the given index.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's appropriate add method, and havinginvalid reference
CollectionBooleanIterators.AbstractIndexBasedIterator.getMaxPos()track the parent.invalid reference
collection's size
Do not modify
BooleanIterators.AbstractIndexBasedIterator.posin this method; the default#add()method takes care of this.See
BooleanIterators.AbstractIndexBasedIterator.posandBooleanIterators.AbstractIndexBasedIterator.get(int)for discussion on what the location means. -
set
protected abstract void set(int location, boolean k) Sets the given item at the given index.See
BooleanIterators.AbstractIndexBasedIterator.posandBooleanIterators.AbstractIndexBasedIterator.get(int)for discussion on what the location means. -
hasPrevious
public boolean hasPrevious()- Specified by:
hasPreviousin interfaceit.unimi.dsi.fastutil.BidirectionalIterator<Boolean>- Specified by:
hasPreviousin interfaceListIterator<Boolean>
-
previousBoolean
public boolean previousBoolean()Description copied from interface:BooleanBidirectionalIteratorReturns the previous element as a primitive type.- Specified by:
previousBooleanin interfaceBooleanBidirectionalIterator- Returns:
- the previous element in the iteration.
- See Also:
-
nextIndex
public int nextIndex()- Specified by:
nextIndexin interfaceListIterator<Boolean>
-
previousIndex
public int previousIndex()- Specified by:
previousIndexin interfaceListIterator<Boolean>
-
add
public void add(boolean k) Description copied from interface:BooleanListIteratorInserts the specified element into the list (optional operation).This default implementation just throws an
UnsupportedOperationException.- Specified by:
addin interfaceBooleanListIterator- Parameters:
k- the element to insert.- See Also:
-
set
public void set(boolean k) Description copied from interface:BooleanListIteratorReplaces the last element returned byBooleanListIterator.next()orBooleanListIterator.previous()with the specified element (optional operation).- Specified by:
setin interfaceBooleanListIterator- Parameters:
k- the element used to replace the last element returned.This default implementation just throws an
UnsupportedOperationException.- See Also:
-
back
public int back(int n) Description copied from interface:BooleanBidirectionalIteratorMoves back for the given number of elements.The effect of this call is exactly the same as that of calling
BooleanBidirectionalIterator.previous()forntimes (possibly stopping ifBidirectionalIterator.hasPrevious()becomes false).- Specified by:
backin interfaceBooleanBidirectionalIterator- Specified by:
backin interfaceit.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator<Boolean>- Parameters:
n- the number of elements to skip back.- Returns:
- the number of elements actually skipped.
- See Also:
-