Class CloseableIteratorAdapter<T>

java.lang.Object
fr.lirmm.graphik.util.stream.CloseableIteratorAdapter<T>
Type Parameters:
T - type of elements of the iterator
All Implemented Interfaces:
CloseableIterator<T>, CloseableIteratorWithoutException<T>, Closeable, AutoCloseable, Iterator<T>

public class CloseableIteratorAdapter<T> extends Object implements CloseableIteratorWithoutException<T>
Adapts standard iterators and streams to the closeable-iterator API.
Author:
Clément Sipieter (INRIA) <clement@6pi.fr>
  • Field Details

    • iterator

      protected Iterator<T> iterator
      Wrapped iterator.
    • stream

      protected Stream<T> stream
      Optional stream associated with the wrapped iterator.
    • isClosed

      protected boolean isClosed
      Indicates whether this adapter has been closed.
  • Constructor Details

    • CloseableIteratorAdapter

      public CloseableIteratorAdapter(Iterator<T> iterator)
      Adapts the specified iterator.
      Parameters:
      iterator - the iterator to adapt
    • CloseableIteratorAdapter

      public CloseableIteratorAdapter(Stream<T> stream)
      Adapts the specified stream.
      Parameters:
      stream - the stream to adapt
  • Method Details