Class BooleanIterators.AbstractIndexBasedListIterator
- java.lang.Object
-
- it.unimi.dsi.fastutil.booleans.AbstractBooleanIterator
-
- it.unimi.dsi.fastutil.booleans.BooleanIterators.AbstractIndexBasedIterator
-
- it.unimi.dsi.fastutil.booleans.BooleanIterators.AbstractIndexBasedListIterator
-
- All Implemented Interfaces:
BidirectionalIterator<java.lang.Boolean>
,BooleanBidirectionalIterator
,BooleanIterator
,BooleanListIterator
,ObjectBidirectionalIterator<java.lang.Boolean>
,ObjectIterator<java.lang.Boolean>
,java.util.Iterator<java.lang.Boolean>
,java.util.ListIterator<java.lang.Boolean>
,java.util.PrimitiveIterator<java.lang.Boolean,BooleanConsumer>
- Enclosing class:
- BooleanIterators
public abstract static class BooleanIterators.AbstractIndexBasedListIterator extends BooleanIterators.AbstractIndexBasedIterator implements BooleanListIterator
A skeletal implementation for a list-iterator backed by an index-based data store. High performance concrete implementations (like the main ListIterator of ArrayList) generally should avoid using this and just implement the interface directly, but should be decent for less performance critical implementations.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 specificBigListSpliterators
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).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(boolean k)
Inserts the specified element into the list (optional operation).int
back(int n)
Moves back for the given number of elements.boolean
hasPrevious()
Returns whether there is a previous element.int
nextIndex()
boolean
previousBoolean()
Returns the previous element as a primitive type.int
previousIndex()
void
set(boolean k)
Replaces the last element returned byBooleanListIterator.next()
orBooleanListIterator.previous()
with the specified element (optional operation).-
Methods inherited from class it.unimi.dsi.fastutil.booleans.BooleanIterators.AbstractIndexBasedIterator
forEachRemaining, hasNext, nextBoolean, remove, skip
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanBidirectionalIterator
skip
-
Methods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanIterator
forEachRemaining, forEachRemaining, nextBoolean
-
-
-
-
Method Detail
-
hasPrevious
public boolean hasPrevious()
Description copied from interface:BidirectionalIterator
Returns whether there is a previous element.- Specified by:
hasPrevious
in interfaceBidirectionalIterator<java.lang.Boolean>
- Specified by:
hasPrevious
in interfacejava.util.ListIterator<java.lang.Boolean>
- Returns:
- whether there is a previous element.
- See Also:
ListIterator.hasPrevious()
-
previousBoolean
public boolean previousBoolean()
Description copied from interface:BooleanBidirectionalIterator
Returns the previous element as a primitive type.- Specified by:
previousBoolean
in interfaceBooleanBidirectionalIterator
- Returns:
- the previous element in the iteration.
- See Also:
ListIterator.previous()
-
nextIndex
public int nextIndex()
- Specified by:
nextIndex
in interfacejava.util.ListIterator<java.lang.Boolean>
-
previousIndex
public int previousIndex()
- Specified by:
previousIndex
in interfacejava.util.ListIterator<java.lang.Boolean>
-
add
public void add(boolean k)
Description copied from interface:BooleanListIterator
Inserts the specified element into the list (optional operation).This default implementation just throws an
UnsupportedOperationException
.- Specified by:
add
in interfaceBooleanListIterator
- Parameters:
k
- the element to insert.- See Also:
ListIterator.add(Object)
-
set
public void set(boolean k)
Description copied from interface:BooleanListIterator
Replaces the last element returned byBooleanListIterator.next()
orBooleanListIterator.previous()
with the specified element (optional operation).- Specified by:
set
in interfaceBooleanListIterator
- Parameters:
k
- the element used to replace the last element returned.This default implementation just throws an
UnsupportedOperationException
.- See Also:
ListIterator.set(Object)
-
back
public int back(int n)
Description copied from interface:BooleanBidirectionalIterator
Moves back for the given number of elements.The effect of this call is exactly the same as that of calling
BooleanBidirectionalIterator.previous()
forn
times (possibly stopping ifBidirectionalIterator.hasPrevious()
becomes false).- Specified by:
back
in interfaceBooleanBidirectionalIterator
- Specified by:
back
in interfaceObjectBidirectionalIterator<java.lang.Boolean>
- Parameters:
n
- the number of elements to skip back.- Returns:
- the number of elements actually skipped.
- See Also:
BooleanBidirectionalIterator.previous()
-
-