Class CharIterators.AbstractIndexBasedListIterator
- All Implemented Interfaces:
BidirectionalIterator<java.lang.Character>,CharBidirectionalIterator,CharIterator,CharListIterator,ObjectBidirectionalIterator<java.lang.Character>,ObjectIterator<java.lang.Character>,java.util.Iterator<java.lang.Character>,java.util.ListIterator<java.lang.Character>,java.util.PrimitiveIterator<java.lang.Character,CharConsumer>
- Enclosing class:
- CharIterators
public abstract static class CharIterators.AbstractIndexBasedListIterator extends CharIterators.AbstractIndexBasedIterator implements CharListIterator
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
java.util.PrimitiveIterator.OfDouble, java.util.PrimitiveIterator.OfInt, java.util.PrimitiveIterator.OfLong -
Method Summary
Modifier and Type Method Description voidadd(char k)Inserts the specified element into the list (optional operation).intback(int n)Moves back for the given number of elements.booleanhasPrevious()Returns whether there is a previous element.intnextIndex()charpreviousChar()Returns the previous element as a primitive type.intpreviousIndex()voidset(char k)Replaces the last element returned byCharListIterator.next()orCharListIterator.previous()with the specified element (optional operation).Methods inherited from class it.unimi.dsi.fastutil.chars.CharIterators.AbstractIndexBasedIterator
forEachRemaining, hasNext, nextChar, remove, skipMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface it.unimi.dsi.fastutil.chars.CharBidirectionalIterator
skipMethods inherited from interface it.unimi.dsi.fastutil.chars.CharIterator
forEachRemaining, forEachRemaining, forEachRemaining, nextCharMethods inherited from interface it.unimi.dsi.fastutil.chars.CharListIterator
add, next, previous, remove, setMethods inherited from interface java.util.ListIterator
hasNext
-
Method Details
-
hasPrevious
public boolean hasPrevious()Description copied from interface:BidirectionalIteratorReturns whether there is a previous element.- Specified by:
hasPreviousin interfaceBidirectionalIterator<java.lang.Character>- Specified by:
hasPreviousin interfacejava.util.ListIterator<java.lang.Character>- Returns:
- whether there is a previous element.
- See Also:
ListIterator.hasPrevious()
-
previousChar
public char previousChar()Description copied from interface:CharBidirectionalIteratorReturns the previous element as a primitive type.- Specified by:
previousCharin interfaceCharBidirectionalIterator- Returns:
- the previous element in the iteration.
- See Also:
ListIterator.previous()
-
nextIndex
public int nextIndex()- Specified by:
nextIndexin interfacejava.util.ListIterator<java.lang.Character>
-
previousIndex
public int previousIndex()- Specified by:
previousIndexin interfacejava.util.ListIterator<java.lang.Character>
-
add
public void add(char k)Description copied from interface:CharListIteratorInserts the specified element into the list (optional operation).This default implementation just throws an
UnsupportedOperationException.- Specified by:
addin interfaceCharListIterator- Parameters:
k- the element to insert.- See Also:
ListIterator.add(Object)
-
set
public void set(char k)Description copied from interface:CharListIteratorReplaces the last element returned byCharListIterator.next()orCharListIterator.previous()with the specified element (optional operation).- Specified by:
setin interfaceCharListIterator- 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:CharBidirectionalIteratorMoves back for the given number of elements.The effect of this call is exactly the same as that of calling
CharBidirectionalIterator.previous()forntimes (possibly stopping ifBidirectionalIterator.hasPrevious()becomes false).- Specified by:
backin interfaceCharBidirectionalIterator- Specified by:
backin interfaceObjectBidirectionalIterator<java.lang.Character>- Parameters:
n- the number of elements to skip back.- Returns:
- the number of elements actually skipped.
- See Also:
CharBidirectionalIterator.previous()
-