Class BufferIterator<T>

java.lang.Object
com.github.basking2.sdsai.itrex.iterators.BufferIterator<T>
All Implemented Interfaces:
Iterator<T>

public class BufferIterator<T> extends Object implements Iterator<T>
A buffer iterator pulls elements from a source iterator and store N elements. This is useful when the down-stream may pull data more slowly form us and the up-stream can product data quickly. This is also useful to build a list of Futures and then consume them, though that use is not intrinsic to this class's operation.
  • Constructor Details

    • BufferIterator

      public BufferIterator(int bufferSize, Iterator<T> source)
  • Method Details

    • hasNext

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

      public T next()
      Specified by:
      next in interface Iterator<T>