Class ObjectSet.ObjectSetIterator<T>

java.lang.Object
com.github.tommyettinger.ds.ObjectSet.ObjectSetIterator<T>
All Implemented Interfaces:
Iterable<T>, Iterator<T>
Direct Known Subclasses:
ObjectOrderedSet.ObjectOrderedSetIterator
Enclosing class:
ObjectSet<T>

public static class ObjectSet.ObjectSetIterator<T> extends Object implements Iterable<T>, Iterator<T>
  • 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 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 ObjectSet<T> set
      The set to iterate over.
  • Constructor Details

    • ObjectSetIterator

      public ObjectSetIterator(ObjectSet<T> set)
  • Method Details

    • reset

      public void reset()
    • findNextIndex

      protected void findNextIndex()
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<T>
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • next

      public T next()
      Specified by:
      next in interface Iterator<T>
    • iterator

      public ObjectSet.ObjectSetIterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • toList

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

      public Collection<T> appendInto(Collection<T> coll)
      Append the remaining items that this can iterate through into the given Collection. Does not change the position of this iterator.
      Parameters:
      coll - any modifiable Collection; may have items appended into it
      Returns:
      the given collection