Class Gatherer.ExtractStep<I,ACC>

java.lang.Object
io.smallrye.mutiny.groups.Gatherer.ExtractStep<I,ACC>
Type Parameters:
I - the type of the items emitted by the upstream Multi
ACC - the type of the accumulator
Enclosing interface:
Gatherer<I,ACC,O>

public static class Gatherer.ExtractStep<I,ACC> extends Object
The second step in the builder to gather items emitted by a Multi into an accumulator.
  • Method Details

    • extract

      @CheckReturnValue public <O> Gatherer.FinalizerStep<I,ACC,O> extract(BiFunction<ACC,Boolean,Optional<Gatherer.Extraction<ACC,O>>> extractor)
      Specifies the extractor function.

      The extractor function is used to extract the items from the accumulator. When the extractor function returns an empty Optional, no value is emitted. When the extractor function returns a non-empty Optional, the value is emitted, and the accumulator is updated. This is done by returning a Gatherer.Extraction containing the new accumulator and the value to emit.

      Type Parameters:
      O - the type of the value to emit
      Parameters:
      extractor - the extractor function, which takes the current accumulator and returns an Optional containing a Gatherer.Extraction with the new accumulator and the value to emit
      Returns:
      the next step in the builder