Class Gatherer.FinalizerStep<I,ACC,O>

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

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

    • finalize

      @CheckReturnValue public Gatherer<I,ACC,O> finalize(Function<ACC,Optional<O>> finalizer)
      Specifies the finalizer function.

      The finalizer function is used to emit the final value upon completion of the upstream and when there are no more items that can be extracted from the accumulator. When the finalizer function returns an empty Optional, no value is emitted before the completion signal. When the finalizer function returns a non-empty Optional, the value is emitted before the completion signal.

      Parameters:
      finalizer - the finalizer function, which takes the current accumulator and returns an Optional containing the value to emit before the completion signal, if any
      Returns:
      the gathering Multi