Interface HandlerBackedIterator.DataProducer<T>

All Superinterfaces:
Cancellable
Enclosing class:
HandlerBackedIterator<T>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface HandlerBackedIterator.DataProducer<T> extends Cancellable
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    cancel(String message)
    Tells the producer that it has been cancelled.
    void
    run(Consumer<T> handler)
    Generates data items and pushes it to the handler.
  • Method Details

    • run

      void run(Consumer<T> handler)
      Generates data items and pushes it to the handler. Note: this method _must_ stop if the handler throws a HandlerBackedIterator.ProducerFinished error. That's the prime way to stop iteration before getting all results.
    • cancel

      default void cancel(String message)
      Tells the producer that it has been cancelled. Normally is called when the iterator gets a cancellation call on the main thread.
      Specified by:
      cancel in interface Cancellable
      Parameters:
      message - the cause of the cancellation or null if the cause is unknown