Class IntSet.IntSetIterator

java.lang.Object
com.github.tommyettinger.ds.IntSet.IntSetIterator
All Implemented Interfaces:
IntIterator, Iterator<Integer>
Direct Known Subclasses:
IntOrderedSet.IntOrderedSetIterator
Enclosing class:
IntSet

public static class IntSet.IntSetIterator extends Object implements IntIterator
  • 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 nextInt() (or, while discouraged because of boxing, IntIterator.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 IntSet set
      The set to iterate over.
  • Constructor Details

    • IntSetIterator

      public IntSetIterator(IntSet 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 IntIterator.next() would return an element rather than throwing an exception.)
      Specified by:
      hasNext in interface Iterator<Integer>
      Returns:
      true if the iteration has more elements
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<Integer>
    • nextInt

      public int nextInt()
      Description copied from interface: IntIterator
      Returns the next int element in the iteration.
      Specified by:
      nextInt in interface IntIterator
      Returns:
      the next int element in the iteration
    • toList

      public IntList toList()
      Returns a new IntList 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.OfInt. Does not change the position of this iterator.
      Parameters:
      coll - any modifiable PrimitiveCollection.OfInt; may have items appended into it
      Returns:
      the given primitive collection