Class ByteIterators.AbstractIndexBasedListIterator
- java.lang.Object
-
- it.unimi.dsi.fastutil.bytes.AbstractByteIterator
-
- it.unimi.dsi.fastutil.bytes.ByteIterators.AbstractIndexBasedIterator
-
- it.unimi.dsi.fastutil.bytes.ByteIterators.AbstractIndexBasedListIterator
-
- All Implemented Interfaces:
BidirectionalIterator<java.lang.Byte>,ByteBidirectionalIterator,ByteIterator,ByteListIterator,ObjectBidirectionalIterator<java.lang.Byte>,ObjectIterator<java.lang.Byte>,java.util.Iterator<java.lang.Byte>,java.util.ListIterator<java.lang.Byte>,java.util.PrimitiveIterator<java.lang.Byte,ByteConsumer>
- Enclosing class:
- ByteIterators
public abstract static class ByteIterators.AbstractIndexBasedListIterator extends ByteIterators.AbstractIndexBasedIterator implements ByteListIterator
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_VALUElong. If your backing data store can be bigger then this, consider the equivalently named class in the type specificBigListSpliteratorsclass.As the abstract methods in this class are used in inner loops, it is generally a good idea to override the class as
finalas 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 voidadd(byte 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()bytepreviousByte()Returns the previous element as a primitive type.intpreviousIndex()voidset(byte k)Replaces the last element returned byByteListIterator.next()orByteListIterator.previous()with the specified element (optional operation).-
Methods inherited from class it.unimi.dsi.fastutil.bytes.ByteIterators.AbstractIndexBasedIterator
forEachRemaining, hasNext, nextByte, 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.bytes.ByteBidirectionalIterator
skip
-
Methods inherited from interface it.unimi.dsi.fastutil.bytes.ByteIterator
forEachRemaining, forEachRemaining, forEachRemaining, nextByte
-
-
-
-
Method Detail
-
hasPrevious
public boolean hasPrevious()
Description copied from interface:BidirectionalIteratorReturns whether there is a previous element.- Specified by:
hasPreviousin interfaceBidirectionalIterator<java.lang.Byte>- Specified by:
hasPreviousin interfacejava.util.ListIterator<java.lang.Byte>- Returns:
- whether there is a previous element.
- See Also:
ListIterator.hasPrevious()
-
previousByte
public byte previousByte()
Description copied from interface:ByteBidirectionalIteratorReturns the previous element as a primitive type.- Specified by:
previousBytein interfaceByteBidirectionalIterator- Returns:
- the previous element in the iteration.
- See Also:
ListIterator.previous()
-
nextIndex
public int nextIndex()
- Specified by:
nextIndexin interfacejava.util.ListIterator<java.lang.Byte>
-
previousIndex
public int previousIndex()
- Specified by:
previousIndexin interfacejava.util.ListIterator<java.lang.Byte>
-
add
public void add(byte k)
Description copied from interface:ByteListIteratorInserts the specified element into the list (optional operation).This default implementation just throws an
UnsupportedOperationException.- Specified by:
addin interfaceByteListIterator- Parameters:
k- the element to insert.- See Also:
ListIterator.add(Object)
-
set
public void set(byte k)
Description copied from interface:ByteListIteratorReplaces the last element returned byByteListIterator.next()orByteListIterator.previous()with the specified element (optional operation).- Specified by:
setin interfaceByteListIterator- 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:ByteBidirectionalIteratorMoves back for the given number of elements.The effect of this call is exactly the same as that of calling
ByteBidirectionalIterator.previous()forntimes (possibly stopping ifBidirectionalIterator.hasPrevious()becomes false).- Specified by:
backin interfaceByteBidirectionalIterator- Specified by:
backin interfaceObjectBidirectionalIterator<java.lang.Byte>- Parameters:
n- the number of elements to skip back.- Returns:
- the number of elements actually skipped.
- See Also:
ByteBidirectionalIterator.previous()
-
-