Class ObjectIterators.AbstractIndexBasedListIterator<K>
- All Implemented Interfaces:
it.unimi.dsi.fastutil.BidirectionalIterator<K>,it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator<K>,it.unimi.dsi.fastutil.objects.ObjectIterator<K>,ObjectListIterator<K>,Iterator<K>,ListIterator<K>
- Enclosing class:
ObjectIterators
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).
-
Field Summary
Fields inherited from class it.unimi.dsi.fastutil.objects.ObjectIterators.AbstractIndexBasedIterator
lastReturned, minPos, pos -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractIndexBasedListIterator(int minPos, int initialPos) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidAdd the given item at the given index.voidInserts the specified element into the list (optional operation).intback(int n) booleanintprevious()intprotected abstract voidSets the given item at the given index.voidReplaces the last element returned byIterator.next()orBidirectionalIterator.previous()with the specified element (optional operation).Methods inherited from class it.unimi.dsi.fastutil.objects.ObjectIterators.AbstractIndexBasedIterator
forEachRemaining, get, getMaxPos, hasNext, next, remove, remove, skipMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemainingMethods inherited from interface java.util.ListIterator
hasNext, nextMethods inherited from interface it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator
skipMethods inherited from interface it.unimi.dsi.fastutil.objects.ObjectListIterator
remove
-
Constructor Details
-
AbstractIndexBasedListIterator
protected AbstractIndexBasedListIterator(int minPos, int initialPos)
-
-
Method Details
-
add
Add the given item at the given index.This method should also do what is needed to track the change to the
ObjectIterators.AbstractIndexBasedIterator.getMaxPos(). Usually this is accomplished by having this method call the parent's appropriate add method, and havinginvalid reference
CollectionObjectIterators.AbstractIndexBasedIterator.getMaxPos()track the parent.invalid reference
collection's size
Do not modify
ObjectIterators.AbstractIndexBasedIterator.posin this method; the default#add()method takes care of this.See
ObjectIterators.AbstractIndexBasedIterator.posandObjectIterators.AbstractIndexBasedIterator.get(int)for discussion on what the location means. -
set
Sets the given item at the given index.See
ObjectIterators.AbstractIndexBasedIterator.posandObjectIterators.AbstractIndexBasedIterator.get(int)for discussion on what the location means. -
hasPrevious
public boolean hasPrevious()- Specified by:
hasPreviousin interfaceit.unimi.dsi.fastutil.BidirectionalIterator<K>- Specified by:
hasPreviousin interfaceListIterator<K>
-
previous
- Specified by:
previousin interfaceit.unimi.dsi.fastutil.BidirectionalIterator<K>- Specified by:
previousin interfaceListIterator<K>
-
nextIndex
public int nextIndex()- Specified by:
nextIndexin interfaceListIterator<K>
-
previousIndex
public int previousIndex()- Specified by:
previousIndexin interfaceListIterator<K>
-
add
Description copied from interface:ObjectListIteratorInserts the specified element into the list (optional operation).This default implementation just throws an
UnsupportedOperationException.- Specified by:
addin interfaceListIterator<K>- Specified by:
addin interfaceObjectListIterator<K>- Parameters:
k- the element to insert.- See Also:
-
set
Description copied from interface:ObjectListIteratorReplaces the last element returned byIterator.next()orBidirectionalIterator.previous()with the specified element (optional operation).- Specified by:
setin interfaceListIterator<K>- Specified by:
setin interfaceObjectListIterator<K>- 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) - Specified by:
backin interfaceit.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator<K>
-