Class MultiIfEmpty<T>

java.lang.Object
io.smallrye.mutiny.groups.MultiIfEmpty<T>

public class MultiIfEmpty<T> extends Object
  • Method Details

    • failWith

      @CheckReturnValue public Multi<T> failWith(Throwable failure)
      When the current Multi completes without having emitted items, the passed failure is sent downstream.
      Parameters:
      failure - the failure
      Returns:
      the new Multi
    • failWith

      @CheckReturnValue public Multi<T> failWith(Supplier<? extends Throwable> supplier)
      When the current Multi completes without having emitted items, a failure produced by the given Supplier is sent downstream.
      Parameters:
      supplier - the supplier to produce the failure, must not be null, must not produce null
      Returns:
      the new Multi
    • fail

      @CheckReturnValue public Multi<T> fail()
      Returns:
      the new Multi
    • switchToEmitter

      @CheckReturnValue public Multi<T> switchToEmitter(Consumer<MultiEmitter<? super T>> consumer)
      When the upstream Multi completes without having emitted items, it continues with the events fired with the emitter passed to the consumer callback.

      If the upstream Multi fails, the switch does not apply.

      Parameters:
      consumer - the callback receiving the emitter to fire the events. Must not be null. Throwing exception in this function propagates a failure downstream.
      Returns:
      the new Multi
    • switchTo

      @CheckReturnValue public Multi<T> switchTo(Flow.Publisher<? extends T> other)
      When the upstream Multi completes without having emitted items, it continues with the events fired by the passed Flow.Publisher / Multi.

      If the upstream Multi fails, the switch does not apply.

      Parameters:
      other - the stream to switch to when the upstream completes.
      Returns:
      the new Multi
    • switchTo

      @CheckReturnValue public Multi<T> switchTo(Supplier<Flow.Publisher<? extends T>> supplier)
      When the upstream Multi completes without having emitted items, it continues with the events fired by a Flow.Publisher produces with the given Supplier.
      Parameters:
      supplier - the supplier to use to produce the publisher, must not be null, must not return nulls
      Returns:
      the new Uni
    • continueWith

      @SafeVarargs @CheckReturnValue public final Multi<T> continueWith(T... items)
      When the upstream Multi completes without having emitted items, continue with the given items.
      Parameters:
      items - the items, must not be null, must not contain null
      Returns:
      the new Multi
    • continueWith

      @CheckReturnValue public Multi<T> continueWith(Iterable<T> items)
      When the upstream Multi completes without having emitted items, continue with the given items.
      Parameters:
      items - the items, must not be null, must not contain null
      Returns:
      the new Multi
    • continueWith

      @CheckReturnValue public Multi<T> continueWith(Supplier<? extends Iterable<? extends T>> supplier)
      When the upstream Multi completes without having emitted items, continue with the items produced by the given Supplier.
      Parameters:
      supplier - the supplier to produce the items, must not be null, must not produce null
      Returns:
      the new Multi