Package com.complexible.common.base

# Class HandlerBackedIterator<T>

java.lang.Object
com.google.common.collect.UnmodifiableIterator<T>
com.google.common.collect.AbstractIterator<T>
com.complexible.common.base.CloseableIterator.AbstractCloseableIterator<T>
com.complexible.common.base.HandlerBackedIterator<T>

All Implemented Interfaces:
  `CloseableIterator<T>`, `AutoCloseable`, `Iterator<T>`

public class HandlerBackedIterator<T> extends CloseableIterator.AbstractCloseableIterator<T>
An adapter for converting push-based data processing (aka handler-based) to pull-based data processing (aka iterator-based).

Since:
  7.4.6
Author:
  Pavel Klinov

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `HandlerBackedIterator.DataProducer<T>`
  `static final class`
  `HandlerBackedIterator.ProducerFinished`
  Can be thrown out of `Consumer.accept(Object)` to indicate that the `producer` must stop generating data.

  ## Nested classes/interfaces inherited from interface com.complexible.common.base.CloseableIterator

  `CloseableIterator.AbstractCloseableIterator<T>, CloseableIterator.DelegatingCloseableIterator<T>, CloseableIterator.EmptyCloseableIterator<T>`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HandlerBackedIterator(HandlerBackedIterator.DataProducer<T> producer, ExecutorService execService, CancelCheck cancelCheck)`
  `HandlerBackedIterator(HandlerBackedIterator.DataProducer<T> producer, ExecutorService execService, CancelCheck cancelCheck, int batchSize)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `protected T`
  `computeNext()`

  ### Methods inherited from class com.google.common.collect.AbstractIterator

  `endOfData, hasNext, next, peek`

  ### Methods inherited from class com.google.common.collect.UnmodifiableIterator

  `remove`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.util.Iterator

  `forEachRemaining, hasNext, next, remove`

- ## Constructor Details

  - ### HandlerBackedIterator

    public HandlerBackedIterator(HandlerBackedIterator.DataProducer<T> producer, ExecutorService execService, CancelCheck cancelCheck)

  - ### HandlerBackedIterator

    public HandlerBackedIterator(HandlerBackedIterator.DataProducer<T> producer, ExecutorService execService, CancelCheck cancelCheck, int batchSize)

- ## Method Details

  - ### close

    public void close()

  - ### computeNext

    protected T computeNext()
    Specified by:
      `computeNext` in class `com.google.common.collect.AbstractIterator<T>`