Class FloatIterators.AbstractIndexBasedListIterator

java.lang.Object
All Implemented Interfaces:
it.unimi.dsi.fastutil.BidirectionalIterator<java.lang.Float>, FloatBidirectionalIterator, it.unimi.dsi.fastutil.floats.FloatIterator, FloatListIterator, it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator<java.lang.Float>, it.unimi.dsi.fastutil.objects.ObjectIterator<java.lang.Float>, java.util.Iterator<java.lang.Float>, java.util.ListIterator<java.lang.Float>, java.util.PrimitiveIterator<java.lang.Float,​FloatConsumer>
Enclosing class:
FloatIterators

public abstract static class FloatIterators.AbstractIndexBasedListIterator
extends FloatIterators.AbstractIndexBasedIterator
implements FloatListIterator
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 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
    void add​(float k)
    Inserts the specified element into the list (optional operation).
    int back​(int n)
    Moves back for the given number of elements.
    boolean hasPrevious()  
    int nextIndex()  
    float previousFloat()
    Returns the previous element as a primitive type.
    int previousIndex()  
    void set​(float k)
    Replaces the last element returned by FloatListIterator.next() or FloatListIterator.previous() with the specified element (optional operation).

    Methods inherited from class it.unimi.dsi.fastutil.floats.FloatIterators.AbstractIndexBasedIterator

    forEachRemaining, hasNext, nextFloat, 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.floats.FloatBidirectionalIterator

    skip

    Methods inherited from interface it.unimi.dsi.fastutil.floats.FloatIterator

    forEachRemaining, forEachRemaining, forEachRemaining, nextFloat

    Methods inherited from interface it.unimi.dsi.fastutil.floats.FloatListIterator

    add, next, previous, remove, set

    Methods inherited from interface java.util.ListIterator

    hasNext
  • Method Details

    • hasPrevious

      public boolean hasPrevious()
      Specified by:
      hasPrevious in interface it.unimi.dsi.fastutil.BidirectionalIterator<java.lang.Float>
      Specified by:
      hasPrevious in interface java.util.ListIterator<java.lang.Float>
    • previousFloat

      public float previousFloat()
      Description copied from interface: FloatBidirectionalIterator
      Returns the previous element as a primitive type.
      Specified by:
      previousFloat in interface FloatBidirectionalIterator
      Returns:
      the previous element in the iteration.
      See Also:
      ListIterator.previous()
    • nextIndex

      public int nextIndex()
      Specified by:
      nextIndex in interface java.util.ListIterator<java.lang.Float>
    • previousIndex

      public int previousIndex()
      Specified by:
      previousIndex in interface java.util.ListIterator<java.lang.Float>
    • add

      public void add​(float k)
      Description copied from interface: FloatListIterator
      Inserts the specified element into the list (optional operation).

      This default implementation just throws an UnsupportedOperationException.

      Specified by:
      add in interface FloatListIterator
      Parameters:
      k - the element to insert.
      See Also:
      ListIterator.add(Object)
    • set

      public void set​(float k)
      Description copied from interface: FloatListIterator
      Replaces the last element returned by FloatListIterator.next() or FloatListIterator.previous() with the specified element (optional operation).
      Specified by:
      set in interface FloatListIterator
      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: FloatBidirectionalIterator
      Moves back for the given number of elements.

      The effect of this call is exactly the same as that of calling FloatBidirectionalIterator.previous() for n times (possibly stopping if BidirectionalIterator.hasPrevious() becomes false).

      Specified by:
      back in interface FloatBidirectionalIterator
      Specified by:
      back in interface it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator<java.lang.Float>
      Parameters:
      n - the number of elements to skip back.
      Returns:
      the number of elements actually skipped.
      See Also:
      FloatBidirectionalIterator.previous()