Class ArrayBlockingQueueToCloseableIteratorAdapter<T>

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

public class ArrayBlockingQueueToCloseableIteratorAdapter<T> extends AbstractCloseableIterator<T>
Adapts a closeable iterator to a buffered closeable iterator backed by an array-blocking stream.
Author:
Clément Sipieter (INRIA) <clement@6pi.fr>
  • Constructor Details

    • ArrayBlockingQueueToCloseableIteratorAdapter

      public ArrayBlockingQueueToCloseableIteratorAdapter(CloseableIterator<T> it)
      Adapts the specified iterator with the default buffer size.
      Parameters:
      it - the iterator to adapt
    • ArrayBlockingQueueToCloseableIteratorAdapter

      public ArrayBlockingQueueToCloseableIteratorAdapter(CloseableIterator<T> it, int bufferSize)
      Adapts the specified iterator with a bounded buffer.
      Parameters:
      it - the iterator to adapt
      bufferSize - the internal buffer size
  • Method Details

    • close

      public void close()
    • hasNext

      public boolean hasNext()
      Description copied from interface: CloseableIterator
      Returns whether another element is available.
      Returns:
      true if another element can be read
    • next

      public T next()
      Description copied from interface: CloseableIterator
      Returns the next element.
      Returns:
      the next element