Class Flowables


  • public final class Flowables
    extends java.lang.Object
    Utility class to create Flowable sources.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T,​S>
      Flowable<T>
      generateAsync​(Supplier<S> initialState, BiFunction<S,​FlowableAsyncEmitter<T>,​S> asyncGenerator, Consumer<? super S> stateCleanup)
      Generates items by invoking a callback, for each downstream request one by one, that sets up an asynchronous call to some API that eventually responds with an item, an error or termination, while making sure there is only one such outstanding API call in progress and honoring the backpressure of the downstream.
      static Flowable<java.lang.Long> intervalBackpressure​(long initialDelay, long period, java.util.concurrent.TimeUnit unit)
      Periodically tries to emit an ever increasing long value or buffers (efficiently) such emissions until the downstream requests.
      static Flowable<java.lang.Long> intervalBackpressure​(long initialDelay, long period, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
      Periodically tries to emit an ever increasing long value or buffers (efficiently) such emissions until the downstream requests.
      static Flowable<java.lang.Long> intervalBackpressure​(long period, java.util.concurrent.TimeUnit unit)
      Periodically tries to emit an ever increasing long value or buffers (efficiently) such emissions until the downstream requests.
      static Flowable<java.lang.Long> intervalBackpressure​(long period, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
      Periodically tries to emit an ever increasing long value or buffers (efficiently) such emissions until the downstream requests.
      static <T extends java.lang.Comparable<? super T>>
      Flowable<T>
      orderedMerge​(boolean delayErrors, int prefetch, Publisher<T>... sources)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order), allows delaying any error they may signal and sets the prefetch amount when requesting from these Publishers.
      static <T extends java.lang.Comparable<? super T>>
      Flowable<T>
      orderedMerge​(boolean delayErrors, Publisher<T>... sources)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order) and allows delaying any error they may signal.
      static <T extends java.lang.Comparable<? super T>>
      Flowable<T>
      orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order).
      static <T extends java.lang.Comparable<? super T>>
      Flowable<T>
      orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources, boolean delayErrors)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order) and allows delaying any error they may signal.
      static <T extends java.lang.Comparable<? super T>>
      Flowable<T>
      orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources, boolean delayErrors, int prefetch)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order), allows delaying any error they may signal and sets the prefetch amount when requesting from these Publishers.
      static <T> Flowable<T> orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources, java.util.Comparator<? super T> comparator)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator).
      static <T> Flowable<T> orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources, java.util.Comparator<? super T> comparator, boolean delayErrors)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator) and allows delaying any error they may signal.
      static <T> Flowable<T> orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources, java.util.Comparator<? super T> comparator, boolean delayErrors, int prefetch)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator), allows delaying any error they may signal and sets the prefetch amount when requesting from these Publishers.
      static <T> Flowable<T> orderedMerge​(java.util.Comparator<? super T> comparator, boolean delayErrors, int prefetch, Publisher<T>... sources)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator), allows delaying any error they may signal and sets the prefetch amount when requesting from these Publishers.
      static <T> Flowable<T> orderedMerge​(java.util.Comparator<? super T> comparator, boolean delayErrors, Publisher<T>... sources)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator) and allows delaying any error they may signal.
      static <T> Flowable<T> orderedMerge​(java.util.Comparator<? super T> comparator, Publisher<T>... sources)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator).
      static <T extends java.lang.Comparable<? super T>>
      Flowable<T>
      orderedMerge​(Publisher<T>... sources)
      Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order).
      static <T> Flowable<T> repeat​(T item)
      Repeats a scalar value indefinitely.
      static <T> Flowable<T> repeatSupplier​(Supplier<T> supplier)
      Repeatedly calls the given Supplier to produce items indefinitely.
      static <T,​R>
      Flowable<R>
      zipLatest​(Function<? super java.lang.Object[],​? extends R> combiner, Scheduler scheduler, Publisher<? extends T>... sources)
      Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.
      static <T,​R>
      Flowable<R>
      zipLatest​(Function<? super java.lang.Object[],​? extends R> combiner, Publisher<? extends T>... sources)
      Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.
      static <T,​R>
      Flowable<R>
      zipLatest​(java.lang.Iterable<? extends Publisher<? extends T>> sources, Function<? super java.lang.Object[],​? extends R> combiner)
      Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.
      static <T,​R>
      Flowable<R>
      zipLatest​(java.lang.Iterable<? extends Publisher<? extends T>> sources, Function<? super java.lang.Object[],​? extends R> combiner, Scheduler scheduler)
      Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.
      static <T1,​T2,​R>
      Flowable<R>
      zipLatest​(Publisher<T1> source1, Publisher<T2> source2, BiFunction<? super T1,​? super T2,​? extends R> combiner)
      Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.
      static <T1,​T2,​R>
      Flowable<R>
      zipLatest​(Publisher<T1> source1, Publisher<T2> source2, BiFunction<? super T1,​? super T2,​? extends R> combiner, Scheduler scheduler)
      Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.
      static <T1,​T2,​T3,​R>
      Flowable<R>
      zipLatest​(Publisher<T1> source1, Publisher<T2> source2, Publisher<T3> source3, Function3<? super T1,​? super T2,​? super T3,​? extends R> combiner)
      Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.
      static <T1,​T2,​T3,​R>
      Flowable<R>
      zipLatest​(Publisher<T1> source1, Publisher<T2> source2, Publisher<T3> source3, Function3<? super T1,​? super T2,​? super T3,​? extends R> combiner, Scheduler scheduler)
      Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.
      static <T1,​T2,​T3,​T4,​R>
      Flowable<R>
      zipLatest​(Publisher<T1> source1, Publisher<T2> source2, Publisher<T3> source3, Publisher<T4> source4, Function4<? super T1,​? super T2,​? super T3,​? super T4,​? extends R> combiner)
      Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.
      static <T1,​T2,​T3,​T4,​R>
      Flowable<R>
      zipLatest​(Publisher<T1> source1, Publisher<T2> source2, Publisher<T3> source3, Publisher<T4> source4, Function4<? super T1,​? super T2,​? super T3,​? super T4,​? extends R> combiner, Scheduler scheduler)
      Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        @SafeVarargs
        public static <T extends java.lang.Comparable<? super T>> Flowable<T> orderedMerge​(Publisher<T>... sources)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order).
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        @SafeVarargs
        public static <T extends java.lang.Comparable<? super T>> Flowable<T> orderedMerge​(boolean delayErrors,
                                                                                           Publisher<T>... sources)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order) and allows delaying any error they may signal.
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        delayErrors - if true, source errors are delayed until all sources terminate in some way
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        @SafeVarargs
        public static <T extends java.lang.Comparable<? super T>> Flowable<T> orderedMerge​(boolean delayErrors,
                                                                                           int prefetch,
                                                                                           Publisher<T>... sources)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order), allows delaying any error they may signal and sets the prefetch amount when requesting from these Publishers.
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        delayErrors - if true, source errors are delayed until all sources terminate in some way
        prefetch - the number of items to prefetch from the sources
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        @SafeVarargs
        public static <T> Flowable<T> orderedMerge​(java.util.Comparator<? super T> comparator,
                                                   Publisher<T>... sources)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator).
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        comparator - the comparator to use for comparing items; it is called with the last known smallest in its first argument
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        @SafeVarargs
        public static <T> Flowable<T> orderedMerge​(java.util.Comparator<? super T> comparator,
                                                   boolean delayErrors,
                                                   Publisher<T>... sources)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator) and allows delaying any error they may signal.
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        comparator - the comparator to use for comparing items; it is called with the last known smallest in its first argument
        delayErrors - if true, source errors are delayed until all sources terminate in some way
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        @SafeVarargs
        public static <T> Flowable<T> orderedMerge​(java.util.Comparator<? super T> comparator,
                                                   boolean delayErrors,
                                                   int prefetch,
                                                   Publisher<T>... sources)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator), allows delaying any error they may signal and sets the prefetch amount when requesting from these Publishers.
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        comparator - the comparator to use for comparing items; it is called with the last known smallest in its first argument
        delayErrors - if true, source errors are delayed until all sources terminate in some way
        prefetch - the number of items to prefetch from the sources
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        public static <T> Flowable<T> orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources,
                                                   java.util.Comparator<? super T> comparator)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator).
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        comparator - the comparator to use for comparing items; it is called with the last known smallest in its first argument
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        public static <T> Flowable<T> orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources,
                                                   java.util.Comparator<? super T> comparator,
                                                   boolean delayErrors)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator) and allows delaying any error they may signal.
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        comparator - the comparator to use for comparing items; it is called with the last known smallest in its first argument
        delayErrors - if true, source errors are delayed until all sources terminate in some way
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        public static <T> Flowable<T> orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources,
                                                   java.util.Comparator<? super T> comparator,
                                                   boolean delayErrors,
                                                   int prefetch)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by the Comparator), allows delaying any error they may signal and sets the prefetch amount when requesting from these Publishers.
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        comparator - the comparator to use for comparing items; it is called with the last known smallest in its first argument
        delayErrors - if true, source errors are delayed until all sources terminate in some way
        prefetch - the number of items to prefetch from the sources
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        public static <T extends java.lang.Comparable<? super T>> Flowable<T> orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order).
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        public static <T extends java.lang.Comparable<? super T>> Flowable<T> orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources,
                                                                                           boolean delayErrors)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order) and allows delaying any error they may signal.
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        delayErrors - if true, source errors are delayed until all sources terminate in some way
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • orderedMerge

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        public static <T extends java.lang.Comparable<? super T>> Flowable<T> orderedMerge​(java.lang.Iterable<? extends Publisher<T>> sources,
                                                                                           boolean delayErrors,
                                                                                           int prefetch)
        Merges the source Publishers in an ordered fashion picking the smallest of the available value from them (determined by their natural order), allows delaying any error they may signal and sets the prefetch amount when requesting from these Publishers.
        Type Parameters:
        T - the value type of all sources
        Parameters:
        sources - the iterable sequence of sources
        delayErrors - if true, source errors are delayed until all sources terminate in some way
        prefetch - the number of items to prefetch from the sources
        Returns:
        the new Flowable instance
        Since:
        0.8.0
      • repeat

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        public static <T> Flowable<T> repeat​(T item)
        Repeats a scalar value indefinitely.
        Type Parameters:
        T - the value type
        Parameters:
        item - the value to repeat
        Returns:
        the new Flowable instance
        Since:
        0.14.2
      • repeatSupplier

        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        public static <T> Flowable<T> repeatSupplier​(Supplier<T> supplier)
        Repeatedly calls the given Supplier to produce items indefinitely.
        Type Parameters:
        T - the value type
        Parameters:
        supplier - the Supplier to call
        Returns:
        the new Flowable instance
        Since:
        0.14.2
      • intervalBackpressure

        @BackpressureSupport(FULL)
        @SchedulerSupport("io.reactivex:computation")
        public static Flowable<java.lang.Long> intervalBackpressure​(long period,
                                                                    java.util.concurrent.TimeUnit unit)
        Periodically tries to emit an ever increasing long value or buffers (efficiently) such emissions until the downstream requests.
        Backpressure:
        The operator honors the backpressure of the downstream and no emission is lost, however, the timing of the reception of the values is now dependent on the downstream backpressure.
        Scheduler:
        The operator uses the computation Scheduler to time the emission and likely deliver the value (unless backpressured).
        Parameters:
        period - the emission period (including the delay for the first emission)
        unit - the emission time unit
        Returns:
        the new Flowable instance
        Since:
        0.15.0
      • intervalBackpressure

        @BackpressureSupport(FULL)
        @SchedulerSupport("custom")
        public static Flowable<java.lang.Long> intervalBackpressure​(long period,
                                                                    java.util.concurrent.TimeUnit unit,
                                                                    Scheduler scheduler)
        Periodically tries to emit an ever increasing long value or buffers (efficiently) such emissions until the downstream requests.
        Backpressure:
        The operator honors the backpressure of the downstream and no emission is lost, however, the timing of the reception of the values is now dependent on the downstream backpressure.
        Scheduler:
        The operator uses the computation Scheduler to time the emission and likely deliver the value (unless backpressured).
        Parameters:
        period - the emission period (including the delay for the first emission)
        unit - the emission time unit
        scheduler - the scheduler to use for timing and likely emitting items
        Returns:
        the new Flowable instance
        Since:
        0.15.0
      • intervalBackpressure

        @BackpressureSupport(FULL)
        @SchedulerSupport("io.reactivex:computation")
        public static Flowable<java.lang.Long> intervalBackpressure​(long initialDelay,
                                                                    long period,
                                                                    java.util.concurrent.TimeUnit unit)
        Periodically tries to emit an ever increasing long value or buffers (efficiently) such emissions until the downstream requests.
        Backpressure:
        The operator honors the backpressure of the downstream and no emission is lost, however, the timing of the reception of the values is now dependent on the downstream backpressure.
        Scheduler:
        The operator uses the computation Scheduler to time the emission and likely deliver the value (unless backpressured).
        Parameters:
        initialDelay - the initial delay before emitting the first 0L
        period - the emission period after the first emission
        unit - the emission time unit
        Returns:
        the new Flowable instance
        Since:
        0.15.0
      • intervalBackpressure

        @BackpressureSupport(FULL)
        @SchedulerSupport("custom")
        public static Flowable<java.lang.Long> intervalBackpressure​(long initialDelay,
                                                                    long period,
                                                                    java.util.concurrent.TimeUnit unit,
                                                                    Scheduler scheduler)
        Periodically tries to emit an ever increasing long value or buffers (efficiently) such emissions until the downstream requests.
        Backpressure:
        The operator honors the backpressure of the downstream and no emission is lost, however, the timing of the reception of the values is now dependent on the downstream backpressure.
        Scheduler:
        The operator uses the Scheduler provided to time the emission and likely deliver the value (unless backpressured).
        Parameters:
        initialDelay - the initial delay before emitting the first 0L
        period - the emission period (including the delay for the first emission)
        unit - the emission time unit
        scheduler - the scheduler to use for timing and likely emitting items
        Returns:
        the new Flowable instance
        Since:
        0.15.0
      • zipLatest

        @BackpressureSupport(UNBOUNDED_IN)
        @SchedulerSupport("none")
        @SafeVarargs
        public static <T,​R> Flowable<R> zipLatest​(Function<? super java.lang.Object[],​? extends R> combiner,
                                                        Publisher<? extends T>... sources)
        Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.

        Non-consumed source values are overwritten by newer values. Unlike combineLatest, source values are not reused to form new combinations.

        If any of the sources runs out of items, the other sources are cancelled and the sequence completes.

        
         A: ---o-o-o------o-o----o---o-|-------
         B: ---------x-x--x-------x-----x--x---
         ======= zipLatest (o, x -> M) ========
         R: ---------M----M-------M-----M|-----
         
        Backpressure:
        The operator honors the backpressure of the downstream and consumes the source Publishers in an unbounded manner, keeping only their latest values temporarily.
        Scheduler:
        The operator doesn't run on any particular Scheduler and the combined item emission happens on the thread that won the internal emission-right race.
        Type Parameters:
        T - the common source value type
        R - the result type
        Parameters:
        combiner - the function receiving the latest values of the sources and returns a value to be emitted to the downstream.
        sources - the array of source Publishers to zip/combine
        Returns:
        the new Flowable instance.
      • zipLatest

        @BackpressureSupport(UNBOUNDED_IN)
        @SchedulerSupport("custom")
        @SafeVarargs
        public static <T,​R> Flowable<R> zipLatest​(Function<? super java.lang.Object[],​? extends R> combiner,
                                                        Scheduler scheduler,
                                                        Publisher<? extends T>... sources)
        Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.

        Non-consumed source values are overwritten by newer values. Unlike combineLatest, source values are not reused to form new combinations.

        If any of the sources runs out of items, the other sources are cancelled and the sequence completes.

        
         A: ---o-o-o------o-o----o---o-|-------
         B: ---------x-x--x-------x-----x--x---
         ======= zipLatest (o, x -> M) ========
         R: ---------M----M-------M-----M|-----
         
        Backpressure:
        The operator honors the backpressure of the downstream and consumes the source Publishers in an unbounded manner, keeping only their latest values temporarily.
        Scheduler:
        The operator emits the combined items on the Scheduler provided.
        Type Parameters:
        T - the common source value type
        R - the result type
        Parameters:
        combiner - the function receiving the latest values of the sources and returns a value to be emitted to the downstream.
        sources - the array of source Publishers to zip/combine
        scheduler - the Scheduler to use for emitting items and/or terminal signals
        Returns:
        the new Flowable instance.
      • zipLatest

        @BackpressureSupport(UNBOUNDED_IN)
        @SchedulerSupport("none")
        public static <T,​R> Flowable<R> zipLatest​(java.lang.Iterable<? extends Publisher<? extends T>> sources,
                                                        Function<? super java.lang.Object[],​? extends R> combiner)
        Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.

        Non-consumed source values are overwritten by newer values. Unlike combineLatest, source values are not reused to form new combinations.

        If any of the sources runs out of items, the other sources are cancelled and the sequence completes.

        
         A: ---o-o-o------o-o----o---o-|-------
         B: ---------x-x--x-------x-----x--x---
         ======= zipLatest (o, x -> M) ========
         R: ---------M----M-------M-----M|-----
         
        Backpressure:
        The operator honors the backpressure of the downstream and consumes the source Publishers in an unbounded manner, keeping only their latest values temporarily.
        Scheduler:
        The operator doesn't run on any particular Scheduler scheduler and the combined item emission happens on the thread that won the internal emission-right race.
        Type Parameters:
        T - the common source value type
        R - the result type
        Parameters:
        combiner - the function receiving the latest values of the sources and returns a value to be emitted to the downstream.
        sources - the array of source Publishers to zip/combine
        Returns:
        the new Flowable instance.
      • zipLatest

        @BackpressureSupport(UNBOUNDED_IN)
        @SchedulerSupport("custom")
        public static <T,​R> Flowable<R> zipLatest​(java.lang.Iterable<? extends Publisher<? extends T>> sources,
                                                        Function<? super java.lang.Object[],​? extends R> combiner,
                                                        Scheduler scheduler)
        Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.

        Non-consumed source values are overwritten by newer values. Unlike combineLatest, source values are not reused to form new combinations.

        If any of the sources runs out of items, the other sources are cancelled and the sequence completes.

        
         A: ---o-o-o------o-o----o---o-|-------
         B: ---------x-x--x-------x-----x--x---
         ======= zipLatest (o, x -> M) ========
         R: ---------M----M-------M-----M|-----
         
        Backpressure:
        The operator honors the backpressure of the downstream and consumes the source Publishers in an unbounded manner, keeping only their latest values temporarily.
        Scheduler:
        The operator emits the combined items on the Scheduler provided.
        Type Parameters:
        T - the common source value type
        R - the result type
        Parameters:
        combiner - the function receiving the latest values of the sources and returns a value to be emitted to the downstream.
        sources - the array of source Publishers to zip/combine
        scheduler - the Scheduler to use for emitting items and/or terminal signals
        Returns:
        the new Flowable instance.
      • zipLatest

        @BackpressureSupport(UNBOUNDED_IN)
        @SchedulerSupport("none")
        public static <T1,​T2,​R> Flowable<R> zipLatest​(Publisher<T1> source1,
                                                                  Publisher<T2> source2,
                                                                  BiFunction<? super T1,​? super T2,​? extends R> combiner)
        Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.

        Non-consumed source values are overwritten by newer values. Unlike combineLatest, source values are not reused to form new combinations.

        If any of the sources runs out of items, the other sources are cancelled and the sequence completes.

        
         A: ---o-o-o------o-o----o---o-|-------
         B: ---------x-x--x-------x-----x--x---
         ======= zipLatest (o, x -> M) ========
         R: ---------M----M-------M-----M|-----
         
        Backpressure:
        The operator honors the backpressure of the downstream and consumes the source Publishers in an unbounded manner, keeping only their latest values temporarily.
        Scheduler:
        The operator doesn't run on any particular Scheduler scheduler and the combined item emission happens on the thread that won the internal emission-right race.
        Type Parameters:
        T1 - the value type of the first source Publisher
        T2 - the value type of the second source Publisher
        R - the result type
        Parameters:
        combiner - the function receiving the latest values of the sources and returns a value to be emitted to the downstream.
        source1 - the first source Publisher instance
        source2 - the second source Publisher instance
        Returns:
        the new Flowable instance.
      • zipLatest

        @BackpressureSupport(UNBOUNDED_IN)
        @SchedulerSupport("custom")
        public static <T1,​T2,​R> Flowable<R> zipLatest​(Publisher<T1> source1,
                                                                  Publisher<T2> source2,
                                                                  BiFunction<? super T1,​? super T2,​? extends R> combiner,
                                                                  Scheduler scheduler)
        Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.

        Non-consumed source values are overwritten by newer values. Unlike combineLatest, source values are not reused to form new combinations.

        If any of the sources runs out of items, the other sources are cancelled and the sequence completes.

        
         A: ---o-o-o------o-o----o---o-|-------
         B: ---------x-x--x-------x-----x--x---
         ======= zipLatest (o, x -> M) ========
         R: ---------M----M-------M-----M|-----
         
        Backpressure:
        The operator honors the backpressure of the downstream and consumes the source Publishers in an unbounded manner, keeping only their latest values temporarily.
        Scheduler:
        The operator emits the combined items on the Scheduler provided.
        Type Parameters:
        T1 - the value type of the first source Publisher
        T2 - the value type of the second source Publisher
        R - the result type
        Parameters:
        combiner - the function receiving the latest values of the sources and returns a value to be emitted to the downstream.
        source1 - the first source Publisher instance
        source2 - the second source Publisher instance
        scheduler - the Scheduler to use for emitting items and/or terminal signals
        Returns:
        the new Flowable instance.
      • zipLatest

        @BackpressureSupport(UNBOUNDED_IN)
        @SchedulerSupport("none")
        public static <T1,​T2,​T3,​R> Flowable<R> zipLatest​(Publisher<T1> source1,
                                                                           Publisher<T2> source2,
                                                                           Publisher<T3> source3,
                                                                           Function3<? super T1,​? super T2,​? super T3,​? extends R> combiner)
        Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.

        Non-consumed source values are overwritten by newer values. Unlike combineLatest, source values are not reused to form new combinations.

        If any of the sources runs out of items, the other sources are cancelled and the sequence completes.

        
         A: ---o-o-o------o-o----o---o-|-------
         B: ---------x-x--x-------x-----x--x---
         ======= zipLatest (o, x -> M) ========
         R: ---------M----M-------M-----M|-----
         
        Backpressure:
        The operator honors the backpressure of the downstream and consumes the source Publishers in an unbounded manner, keeping only their latest values temporarily.
        Scheduler:
        The operator doesn't run on any particular Scheduler scheduler and the combined item emission happens on the thread that won the internal emission-right race.
        Type Parameters:
        T1 - the value type of the first source Publisher
        T2 - the value type of the second source Publisher
        T3 - the value type of the third source Publisher
        R - the result type
        Parameters:
        combiner - the function receiving the latest values of the sources and returns a value to be emitted to the downstream.
        source1 - the first source Publisher instance
        source2 - the second source Publisher instance
        source3 - the third source Publisher instance
        Returns:
        the new Flowable instance.
      • zipLatest

        @BackpressureSupport(UNBOUNDED_IN)
        @SchedulerSupport("custom")
        public static <T1,​T2,​T3,​R> Flowable<R> zipLatest​(Publisher<T1> source1,
                                                                           Publisher<T2> source2,
                                                                           Publisher<T3> source3,
                                                                           Function3<? super T1,​? super T2,​? super T3,​? extends R> combiner,
                                                                           Scheduler scheduler)
        Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.

        Non-consumed source values are overwritten by newer values. Unlike combineLatest, source values are not reused to form new combinations.

        If any of the sources runs out of items, the other sources are cancelled and the sequence completes.

        
         A: ---o-o-o------o-o----o---o-|-------
         B: ---------x-x--x-------x-----x--x---
         ======= zipLatest (o, x -> M) ========
         R: ---------M----M-------M-----M|-----
         
        Backpressure:
        The operator honors the backpressure of the downstream and consumes the source Publishers in an unbounded manner, keeping only their latest values temporarily.
        Scheduler:
        The operator emits the combined items on the Scheduler provided.
        Type Parameters:
        T1 - the value type of the first source Publisher
        T2 - the value type of the second source Publisher
        T3 - the value type of the third source Publisher
        R - the result type
        Parameters:
        combiner - the function receiving the latest values of the sources and returns a value to be emitted to the downstream.
        source1 - the first source Publisher instance
        source2 - the second source Publisher instance
        source3 - the third source Publisher instance
        scheduler - the Scheduler to use for emitting items and/or terminal signals
        Returns:
        the new Flowable instance.
      • zipLatest

        @BackpressureSupport(UNBOUNDED_IN)
        @SchedulerSupport("none")
        public static <T1,​T2,​T3,​T4,​R> Flowable<R> zipLatest​(Publisher<T1> source1,
                                                                                    Publisher<T2> source2,
                                                                                    Publisher<T3> source3,
                                                                                    Publisher<T4> source4,
                                                                                    Function4<? super T1,​? super T2,​? super T3,​? super T4,​? extends R> combiner)
        Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.

        Non-consumed source values are overwritten by newer values. Unlike combineLatest, source values are not reused to form new combinations.

        If any of the sources runs out of items, the other sources are cancelled and the sequence completes.

        
         A: ---o-o-o------o-o----o---o-|-------
         B: ---------x-x--x-------x-----x--x---
         ======= zipLatest (o, x -> M) ========
         R: ---------M----M-------M-----M|-----
         
        Backpressure:
        The operator honors the backpressure of the downstream and consumes the source Publishers in an unbounded manner, keeping only their latest values temporarily.
        Scheduler:
        The operator doesn't run on any particular Scheduler scheduler and the combined item emission happens on the thread that won the internal emission-right race.
        Type Parameters:
        T1 - the value type of the first source Publisher
        T2 - the value type of the second source Publisher
        T3 - the value type of the third source Publisher
        T4 - the value type of the fourth source Publisher
        R - the result type
        Parameters:
        combiner - the function receiving the latest values of the sources and returns a value to be emitted to the downstream.
        source1 - the first source Publisher instance
        source2 - the second source Publisher instance
        source3 - the third source Publisher instance
        source4 - the fourth source Publisher instance
        Returns:
        the new Flowable instance.
      • zipLatest

        @BackpressureSupport(UNBOUNDED_IN)
        @SchedulerSupport("custom")
        public static <T1,​T2,​T3,​T4,​R> Flowable<R> zipLatest​(Publisher<T1> source1,
                                                                                    Publisher<T2> source2,
                                                                                    Publisher<T3> source3,
                                                                                    Publisher<T4> source4,
                                                                                    Function4<? super T1,​? super T2,​? super T3,​? super T4,​? extends R> combiner,
                                                                                    Scheduler scheduler)
        Zips the latest available values of the source Publishers via a combiner function where the emission rate is determined by the slowest Publisher and the downstream consumption rate.

        Non-consumed source values are overwritten by newer values. Unlike combineLatest, source values are not reused to form new combinations.

        If any of the sources runs out of items, the other sources are cancelled and the sequence completes.

        
         A: ---o-o-o------o-o----o---o-|-------
         B: ---------x-x--x-------x-----x--x---
         ======= zipLatest (o, x -> M) ========
         R: ---------M----M-------M-----M|-----
         
        Backpressure:
        The operator honors the backpressure of the downstream and consumes the source Publishers in an unbounded manner, keeping only their latest values temporarily.
        Scheduler:
        The operator emits the combined items on the Scheduler provided.
        Type Parameters:
        T1 - the value type of the first source Publisher
        T2 - the value type of the second source Publisher
        T3 - the value type of the third source Publisher
        T4 - the value type of the fourth source Publisher
        R - the result type
        Parameters:
        combiner - the function receiving the latest values of the sources and returns a value to be emitted to the downstream.
        source1 - the first source Publisher instance
        source2 - the second source Publisher instance
        source3 - the third source Publisher instance
        source4 - the fourth source Publisher instance
        scheduler - the Scheduler to use for emitting items and/or terminal signals
        Returns:
        the new Flowable instance.
      • generateAsync

        @CheckReturnValue
        @BackpressureSupport(FULL)
        @SchedulerSupport("none")
        public static <T,​S> Flowable<T> generateAsync​(Supplier<S> initialState,
                                                            BiFunction<S,​FlowableAsyncEmitter<T>,​S> asyncGenerator,
                                                            Consumer<? super S> stateCleanup)
        Generates items by invoking a callback, for each downstream request one by one, that sets up an asynchronous call to some API that eventually responds with an item, an error or termination, while making sure there is only one such outstanding API call in progress and honoring the backpressure of the downstream.

        This operator allows the bridging of the asynchronous and backpressurable world with the reactive world, where backpressure is the emergent effect of making sure there is only one outstanding API call at a time which responds with at most one item per invocation.

        Note that the implementation may have one outstanding API call even if the downstream hasn't requested more and as such, the resulting item may get cached until the downstream requests for more.

        During the async response, the invocation protocol of the FlowableAsyncEmitter should be as follows:

        
             (onNext | onNothing)? (onError | onComplete)?
         
        In words, an onNext or onNothing (which indicates this particular API call resulted in no items and the next API call can proceed) may be followed by a terminal event.

        The methods Emitter.onNext(Object), Emitter.onError(Throwable), Emitter.onComplete() and FlowableAsyncEmitter.onNothing() should not be called concurrently with each other or outside the context of the generator. The rest of the FlowableAsyncEmitter methods are thread-safe.

        Example:
        Let's assume there is an async API with the following interface definition:

        
         interface AsyncAPI<T> extends AutoCloseable {
        
             CompletableFuture<Void> nextValue(Consumer<? super T> onValue);
        
         }
         
        When the call succeeds, the onValue is invoked with it. If there are no more items, the CompletableFuture returned by the last nextValue is completed (with null). If there is an error, the same CompletableFuture is completed exceptionally. Each nextValue invocation creates a fresh CompletableFuture which can be cancelled if necesary. nextValue should not be invoked again until the onValue callback has been notified.
        An instance of this API can be obtained on demand, thus the state of this operator consists of the AsyncAPI instance supplied for each individual Subscriber. The API can be transformed into a Flowable as follows:
        
         Flowable<Integer> source = Flowable.<Integer, AsyncAPI<Integer>>generateAsync(
        
             // create a fresh API instance for each individual Subscriber
             () -> new AsyncAPIImpl<Integer>(),
        
             // this BiFunction will be called once the operator is ready to receive the next item
             // and will invoke it again only when that item is delivered via emitter.onNext()
             (state, emitter) -> {
        
                 // issue the async API call
                 CompletableFuture<Void> f = state.nextValue(
        
                     // handle the value received
                     value -> {
        
                         // we have the option to signal that item
                         if (value % 2 == 0) {
                             emitter.onNext(value);
                         } else if (value == 101) {
                             // or stop altogether, which will also trigger a cleanup
                             emitter.onComplete();
                         } else {
                             // or drop it and have the operator start a new call
                             emitter.onNothing();
                         }
                     }
                 );
        
                 // This API call may not produce further items or fail
                 f.whenComplete((done, error) -> {
                     // As per the CompletableFuture API, error != null is the error outcome,
                     // done is always null due to the Void type
                     if (error != null) {
                         emitter.onError(error);
                     } else {
                         emitter.onComplete();
                     }
                 });
        
                 // In case the downstream cancels, the current API call
                 // should be cancelled as well
                 emitter.replaceCancellable(() -> f.cancel(true));
        
                 // some sources may want to create a fresh state object
                 // after each invocation of this generator
                 return state;
             },
        
             // cleanup the state object
             state -> { state.close(); }
         )
         
        Backpressure:
        The operator honors downstream backpressure.
        Scheduler:
        generateAsync does not operate by default on a particular Scheduler, however, the signals emitted through the FlowableAsyncEmitter may happen on any thread, depending on the asynchronous API.
        Type Parameters:
        T - the generated item type
        S - the state associated with an individual subscription.
        Parameters:
        initialState - the Supplier that returns a state object for each individual Subscriber to the returned Flowable.
        asyncGenerator - the BiFunction called with the current state value and the FlowableAsyncEmitter object and should return a new state value as well as prepare and issue the async API call in a way that the call's outcome is (eventually) converted into onNext, onError or onComplete calls. The operator ensures the BiFunction is only invoked when the previous async call produced onNext item and this item has been delivered to the downstream.
        stateCleanup - called at most once with the current state object to allow cleaning it up after the flow is cancelled or terminates via Emitter.onError(Throwable) or Emitter.onComplete().
        Returns:
        the new Flowable instance
        Since:
        0.18.9
        See Also:
        Flowable.generate(Supplier, BiFunction, Consumer), FlowableAsyncEmitter