Class SparseArrayIterator<E>

java.lang.Object
org.apache.jena.util.iterator.NiceIterator<E>
org.apache.jena.mem2.iterator.SparseArrayIterator<E>
Type Parameters:
E - the type of the array elements
All Implemented Interfaces:
Iterator<E>, org.apache.jena.atlas.iterator.IteratorCloseable<E>, org.apache.jena.atlas.lib.Closeable, ClosableIterator<E>, ExtendedIterator<E>

public class SparseArrayIterator<E> extends NiceIterator<E> implements Iterator<E>
An iterator over a sparse array, that skips null entries.
  • Constructor Details

    • SparseArrayIterator

      public SparseArrayIterator(E[] entries, Runnable checkForConcurrentModification)
    • SparseArrayIterator

      public SparseArrayIterator(E[] entries, int toIndexExclusive, Runnable checkForConcurrentModification)
  • Method Details

    • hasNext

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

      public E next()
      Returns the next element in the iteration.
      Specified by:
      next in interface Iterator<E>
      Overrides:
      next in class NiceIterator<E>
      Returns:
      the next element in the iteration
      Throws:
      NoSuchElementException - if the iteration has no more elements
    • forEachRemaining

      public void forEachRemaining(Consumer<? super E> action)
      Specified by:
      forEachRemaining in interface Iterator<E>