Interface Stage.FlatMapIterable

  • All Superinterfaces:
    Stage
    Enclosing interface:
    Stage

    public static interface Stage.FlatMapIterable
    extends Stage
    A flat map stage that emits and fattens Iterable.

    The flat map stage must execute the given mapper on each element, and concatenate the iterables emitted by the mapper function into the resulting stream.

    Any RuntimeException thrown by the function must be propagated downstream as an error, and upstream must be cancelled. Any subsequent elements received from upstream before the cancellation signal is handled must be dropped.

    If downstream cancels, then upstream must be cancelled, and if there is a current iterator being published, it must no longer be consumed. The iterator must not be run through to completion in such a circumstance.

    If a currently consumed iterator throws an exception from either its next or hasNext methods, upstream must be cancelled, and the error must be propagated downstream. Any subsequent elements received from upstream before the cancellation signal is handled must be dropped.

    If upstream terminates with an error, then implementations may decide to stop consuming any currently running iterator, and propagate the error immediately, or they may run the iterator through to completion, before propagating the error. For the purpose of failing fast, so that network failures can be detected and handled, it is recommended, but not required, that the failure is propagated downstream as soon as possible, and the iterator not be run through to completion.

    • Method Detail

      • getMapper

        java.util.function.Function<?,​java.lang.Iterable<?>> getMapper()
        The mapper function.
        Returns:
        The mapper function.