Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
*/
package io.reactivex;
import java.util.*;
import java.util.concurrent.*;
import org.reactivestreams.*;
import io.reactivex.Observable;
import io.reactivex.annotations.*;
import io.reactivex.disposables.Disposable;
import io.reactivex.exceptions.Exceptions;
import io.reactivex.flowables.*;
import io.reactivex.functions.*;
import io.reactivex.internal.functions.*;
import io.reactivex.internal.fuseable.*;
import io.reactivex.internal.operators.flowable.*;
import io.reactivex.internal.operators.mixed.*;
import io.reactivex.internal.operators.observable.*;
import io.reactivex.internal.schedulers.ImmediateThinScheduler;
import io.reactivex.internal.subscribers.*;
import io.reactivex.internal.util.*;
import io.reactivex.parallel.ParallelFlowable;
import io.reactivex.plugins.RxJavaPlugins;
import io.reactivex.schedulers.*;
import io.reactivex.subscribers.*;
/**
* The Flowable class that implements the Reactive-Streams Pattern and offers factory methods,
* intermediate operators and the ability to consume reactive dataflows.
*
* Reactive-Streams operates with {@code Publisher}s which {@code Flowable} extends. Many operators
* therefore accept general {@code Publisher}s directly and allow direct interoperation with other
* Reactive-Streams implementations.
*
* The Flowable hosts the default buffer size of 128 elements for operators, accessible via {@link #bufferSize()},
* that can be overridden globally via the system parameter {@code rx2.buffer-size}. Most operators, however, have
* overloads that allow setting their internal buffer size explicitly.
*
* The documentation for this class makes use of marble diagrams. The following legend explains these diagrams:
*
*
*
* For more information see the ReactiveX
* documentation.
*
* @param
* the type of the items emitted by the Flowable
*/
public abstract class Flowable implements Publisher {
/** The default buffer size. */
static final int BUFFER_SIZE;
static {
BUFFER_SIZE = Math.max(1, Integer.getInteger("rx2.buffer-size", 128));
}
/**
* Mirrors the one Publisher in an Iterable of several Publishers that first either emits an item or sends
* a termination notification.
*
*
*
*
Backpressure:
*
The operator itself doesn't interfere with backpressure which is determined by the winning
* {@code Publisher}'s backpressure behavior.
*
Scheduler:
*
{@code amb} does not operate by default on a particular {@link Scheduler}.
*
*
* @param the common element type
* @param sources
* an Iterable of Publishers sources competing to react first. A subscription to each Publisher will
* occur in the same order as in this Iterable.
* @return a Flowable that emits the same sequence as whichever of the source Publishers first
* emitted an item or sent a termination notification
* @see ReactiveX operators documentation: Amb
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.PASS_THROUGH)
@SchedulerSupport(SchedulerSupport.NONE)
public static Flowable amb(Iterable extends Publisher extends T>> sources) {
ObjectHelper.requireNonNull(sources, "sources is null");
return RxJavaPlugins.onAssembly(new FlowableAmb(null, sources));
}
/**
* Mirrors the one Publisher in an array of several Publishers that first either emits an item or sends
* a termination notification.
*
*
*
*
Backpressure:
*
The operator itself doesn't interfere with backpressure which is determined by the winning
* {@code Publisher}'s backpressure behavior.
*
Scheduler:
*
{@code ambArray} does not operate by default on a particular {@link Scheduler}.
*
*
* @param the common element type
* @param sources
* an array of Publisher sources competing to react first. A subscription to each Publisher will
* occur in the same order as in this Iterable.
* @return a Flowable that emits the same sequence as whichever of the source Publishers first
* emitted an item or sent a termination notification
* @see ReactiveX operators documentation: Amb
*/
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.PASS_THROUGH)
@SchedulerSupport(SchedulerSupport.NONE)
public static Flowable ambArray(Publisher extends T>... sources) {
ObjectHelper.requireNonNull(sources, "sources is null");
int len = sources.length;
if (len == 0) {
return empty();
} else
if (len == 1) {
return fromPublisher(sources[0]);
}
return RxJavaPlugins.onAssembly(new FlowableAmb(sources, null));
}
/**
* Returns the default internal buffer size used by most async operators.
*
The value can be overridden via system parameter {@code rx2.buffer-size}
* before the Flowable class is loaded.
* @return the default internal buffer size.
*/
public static int bufferSize() {
return BUFFER_SIZE;
}
/**
* Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
* the source Publishers each time an item is received from any of the source Publishers, where this
* aggregation is defined by a specified function.
*
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
* {@code Function} passed to the method would trigger a {@code ClassCastException}.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
* If the provided array of source Publishers is empty, the resulting sequence completes immediately without emitting
* any items and without any calls to the combiner function.
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatest} does not operate by default on a particular {@link Scheduler}.
*
*
* @param
* the common base type of source values
* @param
* the result type
* @param sources
* the collection of source Publishers
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
public static Flowable combineLatest(Publisher extends T>[] sources, Function super Object[], ? extends R> combiner) {
return combineLatest(sources, combiner, bufferSize());
}
/**
* Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
* the source Publishers each time an item is received from any of the source Publishers, where this
* aggregation is defined by a specified function.
*
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
* {@code Function} passed to the method would trigger a {@code ClassCastException}.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
* If there are no source Publishers provided, the resulting sequence completes immediately without emitting
* any items and without any calls to the combiner function.
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatest} does not operate by default on a particular {@link Scheduler}.
*
*
* @param
* the common base type of source values
* @param
* the result type
* @param sources
* the collection of source Publishers
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
public static Flowable combineLatest(Function super Object[], ? extends R> combiner, Publisher extends T>... sources) {
return combineLatest(sources, combiner, bufferSize());
}
/**
* Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
* the source Publishers each time an item is received from any of the source Publishers, where this
* aggregation is defined by a specified function.
*
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
* {@code Function} passed to the method would trigger a {@code ClassCastException}.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
* If the provided array of source Publishers is empty, the resulting sequence completes immediately without emitting
* any items and without any calls to the combiner function.
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatest} does not operate by default on a particular {@link Scheduler}.
*
*
* @param
* the common base type of source values
* @param
* the result type
* @param sources
* the collection of source Publishers
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @param bufferSize
* the internal buffer size and prefetch amount applied to every source Flowable
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
public static Flowable combineLatest(Publisher extends T>[] sources, Function super Object[], ? extends R> combiner, int bufferSize) {
ObjectHelper.requireNonNull(sources, "sources is null");
if (sources.length == 0) {
return empty();
}
ObjectHelper.requireNonNull(combiner, "combiner is null");
ObjectHelper.verifyPositive(bufferSize, "bufferSize");
return RxJavaPlugins.onAssembly(new FlowableCombineLatest(sources, combiner, bufferSize, false));
}
/**
* Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
* the source Publishers each time an item is received from any of the source Publishers, where this
* aggregation is defined by a specified function.
*
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
* {@code Function} passed to the method would trigger a {@code ClassCastException}.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
* If the provided iterable of source Publishers is empty, the resulting sequence completes immediately without emitting
* any items and without any calls to the combiner function.
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatest} does not operate by default on a particular {@link Scheduler}.
*
*
* @param
* the common base type of source values
* @param
* the result type
* @param sources
* the collection of source Publishers
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
public static Flowable combineLatest(Iterable extends Publisher extends T>> sources,
Function super Object[], ? extends R> combiner) {
return combineLatest(sources, combiner, bufferSize());
}
/**
* Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
* the source Publishers each time an item is received from any of the source Publishers, where this
* aggregation is defined by a specified function.
*
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
* {@code Function} passed to the method would trigger a {@code ClassCastException}.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
* If the provided iterable of source Publishers is empty, the resulting sequence completes immediately without emitting any items and
* without any calls to the combiner function.
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatest} does not operate by default on a particular {@link Scheduler}.
*
*
* @param
* the common base type of source values
* @param
* the result type
* @param sources
* the collection of source Publishers
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @param bufferSize
* the internal buffer size and prefetch amount applied to every source Flowable
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
public static Flowable combineLatest(Iterable extends Publisher extends T>> sources,
Function super Object[], ? extends R> combiner, int bufferSize) {
ObjectHelper.requireNonNull(sources, "sources is null");
ObjectHelper.requireNonNull(combiner, "combiner is null");
ObjectHelper.verifyPositive(bufferSize, "bufferSize");
return RxJavaPlugins.onAssembly(new FlowableCombineLatest(sources, combiner, bufferSize, false));
}
/**
* Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
* the source Publishers each time an item is received from any of the source Publishers, where this
* aggregation is defined by a specified function.
*
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
* {@code Function} passed to the method would trigger a {@code ClassCastException}.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
* If the provided array of source Publishers is empty, the resulting sequence completes immediately without emitting
* any items and without any calls to the combiner function.
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatestDelayError} does not operate by default on a particular {@link Scheduler}.
*
*
* @param
* the common base type of source values
* @param
* the result type
* @param sources
* the collection of source Publishers
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
public static Flowable combineLatestDelayError(Publisher extends T>[] sources,
Function super Object[], ? extends R> combiner) {
return combineLatestDelayError(sources, combiner, bufferSize());
}
/**
* Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
* the source Publishers each time an item is received from any of the source Publishers, where this
* aggregation is defined by a specified function and delays any error from the sources until
* all source Publishers terminate.
*
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
* {@code Function} passed to the method would trigger a {@code ClassCastException}.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
* If there are no source Publishers provided, the resulting sequence completes immediately without emitting
* any items and without any calls to the combiner function.
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatestDelayError} does not operate by default on a particular {@link Scheduler}.
*
*
* @param
* the common base type of source values
* @param
* the result type
* @param sources
* the collection of source Publishers
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
public static Flowable combineLatestDelayError(Function super Object[], ? extends R> combiner,
Publisher extends T>... sources) {
return combineLatestDelayError(sources, combiner, bufferSize());
}
/**
* Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
* the source Publishers each time an item is received from any of the source Publisher, where this
* aggregation is defined by a specified function and delays any error from the sources until
* all source Publishers terminate.
*
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
* {@code Function} passed to the method would trigger a {@code ClassCastException}.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
* If there are no source Publishers provided, the resulting sequence completes immediately without emitting
* any items and without any calls to the combiner function.
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatestDelayError} does not operate by default on a particular {@link Scheduler}.
*
*
* @param
* the common base type of source values
* @param
* the result type
* @param sources
* the collection of source Publishers
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @param bufferSize
* the internal buffer size and prefetch amount applied to every source Publisher
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
public static Flowable combineLatestDelayError(Function super Object[], ? extends R> combiner,
int bufferSize, Publisher extends T>... sources) {
return combineLatestDelayError(sources, combiner, bufferSize);
}
/**
* Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
* the source Publishers each time an item is received from any of the source Publishers, where this
* aggregation is defined by a specified function and delays any error from the sources until
* all source Publishers terminate.
*
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
* {@code Function} passed to the method would trigger a {@code ClassCastException}.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
* If the provided array of source Publishers is empty, the resulting sequence completes immediately without emitting
* any items and without any calls to the combiner function.
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatestDelayError} does not operate by default on a particular {@link Scheduler}.
*
*
* @param
* the common base type of source values
* @param
* the result type
* @param sources
* the collection of source Publishers
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @param bufferSize
* the internal buffer size and prefetch amount applied to every source Flowable
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
public static Flowable combineLatestDelayError(Publisher extends T>[] sources,
Function super Object[], ? extends R> combiner, int bufferSize) {
ObjectHelper.requireNonNull(sources, "sources is null");
ObjectHelper.requireNonNull(combiner, "combiner is null");
ObjectHelper.verifyPositive(bufferSize, "bufferSize");
if (sources.length == 0) {
return empty();
}
return RxJavaPlugins.onAssembly(new FlowableCombineLatest(sources, combiner, bufferSize, true));
}
/**
* Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
* the source Publishers each time an item is received from any of the source Publishers, where this
* aggregation is defined by a specified function and delays any error from the sources until
* all source Publishers terminate.
*
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
* {@code Function} passed to the method would trigger a {@code ClassCastException}.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
* If the provided iterable of source Publishers is empty, the resulting sequence completes immediately without emitting
* any items and without any calls to the combiner function.
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatestDelayError} does not operate by default on a particular {@link Scheduler}.
*
*
* @param
* the common base type of source values
* @param
* the result type
* @param sources
* the collection of source Publishers
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
public static Flowable combineLatestDelayError(Iterable extends Publisher extends T>> sources,
Function super Object[], ? extends R> combiner) {
return combineLatestDelayError(sources, combiner, bufferSize());
}
/**
* Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of
* the source Publishers each time an item is received from any of the source Publishers, where this
* aggregation is defined by a specified function and delays any error from the sources until
* all source Publishers terminate.
*
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a
* {@code Function} passed to the method would trigger a {@code ClassCastException}.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
* If the provided iterable of source Publishers is empty, the resulting sequence completes immediately without emitting
* any items and without any calls to the combiner function.
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatestDelayError} does not operate by default on a particular {@link Scheduler}.
*
*
* @param
* the common base type of source values
* @param
* the result type
* @param sources
* the collection of source Publishers
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @param bufferSize
* the internal buffer size and prefetch amount applied to every source Flowable
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
public static Flowable combineLatestDelayError(Iterable extends Publisher extends T>> sources,
Function super Object[], ? extends R> combiner, int bufferSize) {
ObjectHelper.requireNonNull(sources, "sources is null");
ObjectHelper.requireNonNull(combiner, "combiner is null");
ObjectHelper.verifyPositive(bufferSize, "bufferSize");
return RxJavaPlugins.onAssembly(new FlowableCombineLatest(sources, combiner, bufferSize, true));
}
/**
* Combines two source Publishers by emitting an item that aggregates the latest values of each of the
* source Publishers each time an item is received from either of the source Publishers, where this
* aggregation is defined by a specified function.
*
* If any of the sources never produces an item but only terminates (normally or with an error), the
* resulting sequence terminates immediately (normally or with all the errors accumulated until that point).
* If that input source is also synchronous, other sources after it will not be subscribed to.
*
*
*
*
Backpressure:
*
The returned {@code Publisher} honors backpressure from downstream. The source {@code Publisher}s
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.
*
Scheduler:
*
{@code combineLatest} does not operate by default on a particular {@link Scheduler}.
*
*
* @param the element type of the first source
* @param the element type of the second source
* @param the combined output type
* @param source1
* the first source Publisher
* @param source2
* the second source Publisher
* @param combiner
* the aggregation function used to combine the items emitted by the source Publishers
* @return a Flowable that emits items that are the result of combining the items emitted by the source
* Publishers by means of the given aggregation function
* @see ReactiveX operators documentation: CombineLatest
*/
@SuppressWarnings("unchecked")
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public static Flowable combineLatest(
Publisher extends T1> source1, Publisher extends T2> source2,
BiFunction super T1, ? super T2, ? extends R> combiner) {
ObjectHelper.requireNonNull(source1, "source1 is null");
ObjectHelper.requireNonNull(source2, "source2 is null");
Function