Class PrefetchingIterator<E>

java.lang.Object
uk.co.parnmatt.vector.util.PrefetchingIterator<E>
Type Parameters:
E - the type of elements in this iterator
All Implemented Interfaces:
Iterator<E>
Direct Known Subclasses:
VectorFileIterators.ByteVectorFileIterator, VectorFileIterators.DoubleVectorFileIterator, VectorFileIterators.FloatVectorFileIterator, VectorFileIterators.IntVectorFileIterator, VectorFileIterators.LongVectorFileIterator, VectorFileIterators.ShortVectorFileIterator

public abstract class PrefetchingIterator<E> extends Object implements Iterator<E>
An abstract iterator for when the total number of element are unknown. The call to #hasNext() will fetch and cache the next element, and peak at the value to determine if iteration should conclude.
See Also:
  • Constructor Details

    • PrefetchingIterator

      public PrefetchingIterator()
  • Method Details

    • next

      public final E next()
      Specified by:
      next in interface Iterator<E>
    • hasNext

      public final boolean hasNext()
      Specified by:
      hasNext in interface Iterator<E>
    • fetch

      protected abstract E fetch()
      Returns:
      the next element in the iteration, or null to indicate the end of the iterator