Class MultiOnItemGather.FinalizerStep<I,ACC,O>

java.lang.Object
io.smallrye.mutiny.groups.MultiOnItemGather.FinalizerStep<I,ACC,O>
Type Parameters:
I - the type of the items emitted by the upstream Multi
ACC - the type of the accumulator
O - the type of the values to emit
Enclosing class:
MultiOnItemGather<I>

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

    • finalize

      @CheckReturnValue public Multi<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