Class CloseableIteratorIteration<E>

java.lang.Object
org.eclipse.rdf4j.common.iteration.CloseableIteratorIteration<E>
All Implemented Interfaces:
AutoCloseable, Iterator<E>, CloseableIteration<E>

public class CloseableIteratorIteration<E> extends Object implements CloseableIteration<E>
An Iteration that can convert an Iterator to a CloseableIteration.
  • Constructor Details

    • CloseableIteratorIteration

      public CloseableIteratorIteration(Iterator<? extends E> iter)
      Creates a CloseableIteratorIteration that wraps the supplied iterator.
  • Method Details

    • hasNext

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

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

      public void remove()
      Specified by:
      remove in interface Iterator<E>
    • handleClose

      protected void handleClose()
    • isClosed

      public final boolean isClosed()
      Checks whether this CloseableIteration has been closed.
      Returns:
      true if the CloseableIteration has been closed, false otherwise.
    • close

      public final void close()
      Calls handleClose() upon first call and makes sure the resource closures are only executed once.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface CloseableIteration<E>