Class LongSet.LongSetIterator

java.lang.Object
com.github.tommyettinger.ds.LongSet.LongSetIterator
All Implemented Interfaces:
LongIterator, Iterator<Long>
Direct Known Subclasses:
LongOrderedSet.LongOrderedSetIterator
Enclosing class:
LongSet

public static class LongSet.LongSetIterator extends Object implements LongIterator
  • Field Details

    • hasNext

      public boolean hasNext
      This can be queried in place of calling hasNext(). The method also performs a check that the iterator is valid, where using the field does not check.
    • nextIndex

      protected int nextIndex
      The next index in the set's key table to go to and return from nextLong() (or, while discouraged because of boxing, LongIterator.next()).
    • currentIndex

      protected int currentIndex
      The current index in the set's key table; this is the index that will be removed if remove() is called.
    • valid

      protected boolean valid
      Internally employed by the iterator-reuse functionality.
    • set

      protected final LongSet set
      The set to iterate over.
  • Constructor Details

    • LongSetIterator

      public LongSetIterator(LongSet set)
  • Method Details

    • reset

      public void reset()
    • findNextIndex

      protected void findNextIndex()
    • hasNext

      public boolean hasNext()
      Returns true if the iteration has more elements. (In other words, returns true if LongIterator.next() would return an element rather than throwing an exception.)
      Specified by:
      hasNext in interface Iterator<Long>
      Returns:
      true if the iteration has more elements
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<Long>
    • nextLong

      public long nextLong()
      Description copied from interface: LongIterator
      Returns the next long element in the iteration.
      Specified by:
      nextLong in interface LongIterator
      Returns:
      the next long element in the iteration
    • toList

      public LongList toList()
      Returns a new LongList containing the remaining items. Does not change the position of this iterator.
    • appendInto

      Append the remaining items that this can iterate through into the given PrimitiveCollection.OfLong. Does not change the position of this iterator.
      Parameters:
      coll - any modifiable PrimitiveCollection.OfLong; may have items appended into it
      Returns:
      the given primitive collection