Class IntIterators.AbstractIndexBasedListIterator
- All Implemented Interfaces:
BidirectionalIterator<Integer>
,IntBidirectionalIterator
,IntIterator
,IntListIterator
,ObjectBidirectionalIterator<Integer>
,ObjectIterator<Integer>
,Iterator<Integer>
,ListIterator<Integer>
,PrimitiveIterator<Integer,
,IntConsumer> PrimitiveIterator.OfInt
- Enclosing class:
IntIterators
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int k) Inserts the specified element into the list (optional operation).int
back
(int n) Moves back for the given number of elements.boolean
Returns whether there is a previous element.int
int
int
Returns the previous element as a primitive type.void
set
(int k) Replaces the last element returned byIntListIterator.next()
orIntListIterator.previous()
with the specified element (optional operation).Methods inherited from class it.unimi.dsi.fastutil.ints.IntIterators.AbstractIndexBasedIterator
forEachRemaining, hasNext, nextInt, remove, skip
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntIterator
forEachRemaining
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntBidirectionalIterator
skip
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterator
forEachRemaining, forEachRemaining, nextInt
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntListIterator
add, next, previous, remove, set
Methods inherited from interface java.util.ListIterator
hasNext
Methods inherited from interface java.util.PrimitiveIterator.OfInt
forEachRemaining
-
Method Details
-
hasPrevious
public boolean hasPrevious()Description copied from interface:BidirectionalIterator
Returns whether there is a previous element.- Specified by:
hasPrevious
in interfaceBidirectionalIterator<Integer>
- Specified by:
hasPrevious
in interfaceListIterator<Integer>
- Returns:
- whether there is a previous element.
- See Also:
-
previousInt
public int previousInt()Description copied from interface:IntBidirectionalIterator
Returns the previous element as a primitive type.- Specified by:
previousInt
in interfaceIntBidirectionalIterator
- Returns:
- the previous element in the iteration.
- See Also:
-
nextIndex
public int nextIndex()- Specified by:
nextIndex
in interfaceListIterator<Integer>
-
previousIndex
public int previousIndex()- Specified by:
previousIndex
in interfaceListIterator<Integer>
-
add
public void add(int k) Description copied from interface:IntListIterator
Inserts the specified element into the list (optional operation).This default implementation just throws an
UnsupportedOperationException
.- Specified by:
add
in interfaceIntListIterator
- Parameters:
k
- the element to insert.- See Also:
-
set
public void set(int k) Description copied from interface:IntListIterator
Replaces the last element returned byIntListIterator.next()
orIntListIterator.previous()
with the specified element (optional operation).- Specified by:
set
in interfaceIntListIterator
- 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:IntBidirectionalIterator
Moves back for the given number of elements.The effect of this call is exactly the same as that of calling
IntBidirectionalIterator.previous()
forn
times (possibly stopping ifBidirectionalIterator.hasPrevious()
becomes false).- Specified by:
back
in interfaceIntBidirectionalIterator
- Specified by:
back
in interfaceObjectBidirectionalIterator<Integer>
- Parameters:
n
- the number of elements to skip back.- Returns:
- the number of elements actually skipped.
- See Also:
-