public final class RxJava3Interop
extends java.lang.Object
to(Function) methods to
enable interoperation between the base reactive types
and some of their features.| Modifier and Type | Method and Description |
|---|---|
static <T> io.reactivex.observable.Single<java.lang.Boolean> |
all(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Predicate<? super T> predicate) |
static <T> io.reactivex.observable.Single<java.lang.Boolean> |
any(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Predicate<? super T> predicate) |
static <T,C> io.reactivex.observable.Single<C> |
collect(io.reactivex.flowable.Flowable<T> source,
java.util.concurrent.Callable<C> collectionSupplier,
io.reactivex.common.functions.BiConsumer<? super C,? super T> collector) |
static <T> io.reactivex.observable.Completable |
concatCompletable(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources) |
static <T> io.reactivex.observable.Completable |
concatCompletable(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources,
int prefetch) |
static <T> io.reactivex.flowable.Flowable<T> |
concatMaybe(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Maybe<? extends T>> sources) |
static <T> io.reactivex.flowable.Flowable<T> |
concatMaybe(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Maybe<? extends T>> sources,
int prefetch) |
static <T> io.reactivex.flowable.Flowable<T> |
concatSingle(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Single<? extends T>> sources) |
static <T> io.reactivex.flowable.Flowable<T> |
concatSingle(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Single<? extends T>> sources,
int prefetch) |
static <T> io.reactivex.observable.Single<java.lang.Long> |
count(io.reactivex.flowable.Flowable<T> source) |
static <T> io.reactivex.observable.Maybe<T> |
elementAt(io.reactivex.flowable.Flowable<T> source,
long index) |
static <T> io.reactivex.observable.Single<T> |
elementAt(io.reactivex.flowable.Flowable<T> source,
long index,
T defaultItem) |
static <T> io.reactivex.observable.Single<T> |
elementAtOrError(io.reactivex.flowable.Flowable<T> source,
long index) |
static <T> io.reactivex.observable.Single<T> |
first(io.reactivex.flowable.Flowable<T> source,
T defaultItem) |
static <T> io.reactivex.observable.Maybe<T> |
firstElement(io.reactivex.flowable.Flowable<T> source) |
static <T> io.reactivex.observable.Single<T> |
firstOrError(io.reactivex.flowable.Flowable<T> source) |
static <T> io.reactivex.observable.Completable |
flatMapCompletable(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.CompletableSource> mapper) |
static <T> io.reactivex.observable.Completable |
flatMapCompletable(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.CompletableSource> mapper,
boolean delayError,
int prefetch) |
static <T,R> io.reactivex.flowable.Flowable<R> |
flatMapMaybe(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.MaybeSource<? extends R>> mapper) |
static <T,R> io.reactivex.flowable.Flowable<R> |
flatMapMaybe(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.MaybeSource<? extends R>> mapper,
boolean delayError,
int maxConcurrency) |
static <T,R> io.reactivex.flowable.Flowable<R> |
flatMapPublisher(io.reactivex.observable.Maybe<T> source,
io.reactivex.common.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper) |
static <T,R> io.reactivex.flowable.Flowable<R> |
flatMapPublisher(io.reactivex.observable.Single<T> source,
io.reactivex.common.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper) |
static <T,R> io.reactivex.flowable.Flowable<R> |
flatMapSingle(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.SingleSource<? extends R>> mapper) |
static <T,R> io.reactivex.flowable.Flowable<R> |
flatMapSingle(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.SingleSource<? extends R>> mapper,
boolean delayError,
int maxConcurrency) |
static <T,R> io.reactivex.flowable.Flowable<R> |
flattenAsFlowable(io.reactivex.observable.Maybe<T> source,
io.reactivex.common.functions.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper) |
static <T,R> io.reactivex.flowable.Flowable<R> |
flattenAsFlowable(io.reactivex.observable.Single<T> source,
io.reactivex.common.functions.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper) |
static <T> io.reactivex.observable.Completable |
ignoreElements(io.reactivex.flowable.Flowable<T> source) |
static <T> io.reactivex.observable.Single<java.lang.Boolean> |
isEmpty(io.reactivex.flowable.Flowable<T> source) |
static <T> io.reactivex.observable.Single<T> |
last(io.reactivex.flowable.Flowable<T> source,
T defaultItem) |
static <T> io.reactivex.observable.Maybe<T> |
lastElement(io.reactivex.flowable.Flowable<T> source) |
static <T> io.reactivex.observable.Single<T> |
lastOrError(io.reactivex.flowable.Flowable<T> source) |
static <T> io.reactivex.observable.Completable |
mergeCompletable(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources) |
static <T> io.reactivex.observable.Completable |
mergeCompletable(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources,
int maxConcurrency) |
static <T> io.reactivex.observable.Completable |
mergeCompletableDelayError(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources) |
static <T> io.reactivex.observable.Completable |
mergeCompletableDelayError(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources,
int maxConcurrency) |
static <T,R> io.reactivex.flowable.Flowable<R> |
mergeMaybe(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Maybe<? extends R>> sources) |
static <T,R> io.reactivex.flowable.Flowable<R> |
mergeMaybe(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Maybe<? extends R>> sources,
int maxConcurrency) |
static <T,R> io.reactivex.flowable.Flowable<R> |
mergeSingle(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Single<? extends R>> sources) |
static <T> io.reactivex.observable.Maybe<T> |
reduce(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.BiFunction<T,T,T> reducer) |
static <T,R> io.reactivex.observable.Single<R> |
reduce(io.reactivex.flowable.Flowable<T> source,
R seed,
io.reactivex.common.functions.BiFunction<R,? super T,R> reducer) |
static <T,R> io.reactivex.observable.Single<R> |
reduceWith(io.reactivex.flowable.Flowable<T> source,
java.util.concurrent.Callable<R> seed,
io.reactivex.common.functions.BiFunction<R,? super T,R> reducer) |
static <T> io.reactivex.observable.Single<T> |
single(io.reactivex.flowable.Flowable<T> source,
T defaultItem) |
static <T> io.reactivex.observable.Maybe<T> |
singleElement(io.reactivex.flowable.Flowable<T> source) |
static <T> io.reactivex.observable.Single<T> |
singleOrError(io.reactivex.flowable.Flowable<T> source) |
static <T,U> io.reactivex.observable.Maybe<T> |
takeUntil(io.reactivex.observable.Maybe<T> source,
org.reactivestreams.Publisher<U> other) |
static <T,U> io.reactivex.observable.Single<T> |
takeUntil(io.reactivex.observable.Single<T> source,
org.reactivestreams.Publisher<U> other) |
static <T,U> io.reactivex.observable.Maybe<T> |
timeout(io.reactivex.observable.Maybe<T> source,
org.reactivestreams.Publisher<U> other) |
static <T,U> io.reactivex.observable.Maybe<T> |
timeout(io.reactivex.observable.Maybe<T> source,
org.reactivestreams.Publisher<U> other,
io.reactivex.observable.Maybe<T> fallback) |
static <T> io.reactivex.flowable.Flowable<T> |
toFlowable(io.reactivex.observable.CompletableSource source) |
static <T> io.reactivex.flowable.Flowable<T> |
toFlowable(io.reactivex.observable.MaybeSource<T> source) |
static <T> io.reactivex.flowable.Flowable<T> |
toFlowable(io.reactivex.observable.ObservableSource<T> source,
io.reactivex.flowable.BackpressureStrategy strategy) |
static <T> io.reactivex.flowable.Flowable<T> |
toFlowable(io.reactivex.observable.SingleSource<T> source) |
static <T> io.reactivex.observable.Single<java.util.List<T>> |
toList(io.reactivex.flowable.Flowable<T> source) |
static <T,C extends java.util.Collection<? super T>> |
toList(io.reactivex.flowable.Flowable<T> source,
java.util.concurrent.Callable<C> collectionSupplier) |
static <T> io.reactivex.observable.Single<java.util.List<T>> |
toList(io.reactivex.flowable.Flowable<T> source,
int capacityHint) |
static <T,K> io.reactivex.observable.Single<java.util.Map<K,T>> |
toMap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector)
Returns a Single that emits a single HashMap containing all items emitted by the source Publisher,
mapped by the keys returned by a specified
keySelector function. |
static <T,K,V> io.reactivex.observable.Single<java.util.Map<K,V>> |
toMap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector,
io.reactivex.common.functions.Function<? super T,? extends V> valueSelector)
Returns a Single that emits a single HashMap containing values corresponding to items emitted by the
source Publisher, mapped by the keys returned by a specified
keySelector function. |
static <T,K,V> io.reactivex.observable.Single<java.util.Map<K,V>> |
toMap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector,
io.reactivex.common.functions.Function<? super T,? extends V> valueSelector,
java.util.concurrent.Callable<? extends java.util.Map<K,V>> mapSupplier)
Returns a Single that emits a single Map, returned by a specified
mapFactory function, that
contains keys and values extracted from the items emitted by the source Publisher. |
static <T,K> io.reactivex.observable.Single<java.util.Map<K,java.util.Collection<T>>> |
toMultimap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector)
Returns a Single that emits a single HashMap that contains an ArrayList of items emitted by the
source Publisher keyed by a specified
keySelector function. |
static <T,K,V> io.reactivex.observable.Single<java.util.Map<K,java.util.Collection<V>>> |
toMultimap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector,
io.reactivex.common.functions.Function<? super T,? extends V> valueSelector)
Returns a Single that emits a single HashMap that contains an ArrayList of values extracted by a
specified
valueSelector function from items emitted by the source Publisher, keyed by a
specified keySelector function. |
static <T,K,V> io.reactivex.observable.Single<java.util.Map<K,java.util.Collection<V>>> |
toMultimap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector,
io.reactivex.common.functions.Function<? super T,? extends V> valueSelector,
java.util.concurrent.Callable<? extends java.util.Map<K,java.util.Collection<V>>> mapSupplier,
io.reactivex.common.functions.Function<? super K,? extends java.util.Collection<? super V>> collectionFactory)
Returns a Single that emits a single Map, returned by a specified
mapFactory function, that
contains a custom collection of values, extracted by a specified valueSelector function from
items emitted by the source Publisher, and keyed by the keySelector function. |
static <T,K,V> io.reactivex.observable.Single<java.util.Map<K,java.util.Collection<V>>> |
toMultimap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector,
io.reactivex.common.functions.Function<? super T,? extends V> valueSelector,
java.util.concurrent.Callable<java.util.Map<K,java.util.Collection<V>>> mapSupplier)
Returns a Single that emits a single Map, returned by a specified
mapFactory function, that
contains an ArrayList of values, extracted by a specified valueSelector function from items
emitted by the source Publisher and keyed by the keySelector function. |
static <T> io.reactivex.observable.Observable<T> |
toObservable(io.reactivex.flowable.Flowable<T> source) |
static <T> io.reactivex.observable.Single<java.util.List<T>> |
toSortedList(io.reactivex.flowable.Flowable<T> source)
Returns a Single that emits a list that contains the items emitted by the source Publisher, in a
sorted order.
|
static <T> io.reactivex.observable.Single<java.util.List<T>> |
toSortedList(io.reactivex.flowable.Flowable<T> source,
java.util.Comparator<? super T> comparator)
Returns a Single that emits a list that contains the items emitted by the source Publisher, in a
sorted order based on a specified comparison function.
|
static <T> io.reactivex.observable.Single<java.util.List<T>> |
toSortedList(io.reactivex.flowable.Flowable<T> source,
java.util.Comparator<? super T> comparator,
int capacityHint)
Returns a Single that emits a list that contains the items emitted by the source Publisher, in a
sorted order based on a specified comparison function.
|
static <T> io.reactivex.observable.Single<java.util.List<T>> |
toSortedList(io.reactivex.flowable.Flowable<T> source,
int capacityHint)
Returns a Flowable that emits a list that contains the items emitted by the source Publisher, in a
sorted order.
|
static <S extends io.reactivex.common.Scheduler & io.reactivex.common.Disposable> |
when(io.reactivex.common.Scheduler scheduler,
io.reactivex.common.functions.Function<io.reactivex.flowable.Flowable<io.reactivex.flowable.Flowable<io.reactivex.observable.Completable>>,io.reactivex.observable.Completable> combine)
Allows the use of operators for controlling the timing around when
actions scheduled on workers are actually done.
|
public static <T> io.reactivex.flowable.Flowable<T> toFlowable(io.reactivex.observable.ObservableSource<T> source,
io.reactivex.flowable.BackpressureStrategy strategy)
public static <T> io.reactivex.flowable.Flowable<T> toFlowable(io.reactivex.observable.SingleSource<T> source)
public static <T> io.reactivex.flowable.Flowable<T> toFlowable(io.reactivex.observable.MaybeSource<T> source)
public static <T> io.reactivex.flowable.Flowable<T> toFlowable(io.reactivex.observable.CompletableSource source)
public static <T> io.reactivex.observable.Observable<T> toObservable(io.reactivex.flowable.Flowable<T> source)
public static <T> io.reactivex.observable.Single<java.util.List<T>> toList(io.reactivex.flowable.Flowable<T> source)
public static <T> io.reactivex.observable.Single<java.util.List<T>> toList(io.reactivex.flowable.Flowable<T> source,
int capacityHint)
public static <T,C extends java.util.Collection<? super T>> io.reactivex.observable.Single<C> toList(io.reactivex.flowable.Flowable<T> source,
java.util.concurrent.Callable<C> collectionSupplier)
public static <T> io.reactivex.observable.Completable ignoreElements(io.reactivex.flowable.Flowable<T> source)
public static <T> io.reactivex.observable.Maybe<T> reduce(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.BiFunction<T,T,T> reducer)
public static <T,R> io.reactivex.observable.Single<R> reduceWith(io.reactivex.flowable.Flowable<T> source,
java.util.concurrent.Callable<R> seed,
io.reactivex.common.functions.BiFunction<R,? super T,R> reducer)
public static <T,R> io.reactivex.observable.Single<R> reduce(io.reactivex.flowable.Flowable<T> source,
R seed,
io.reactivex.common.functions.BiFunction<R,? super T,R> reducer)
public static <T,R> io.reactivex.flowable.Flowable<R> flatMapSingle(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.SingleSource<? extends R>> mapper)
public static <T,R> io.reactivex.flowable.Flowable<R> flatMapSingle(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.SingleSource<? extends R>> mapper,
boolean delayError,
int maxConcurrency)
public static <T,R> io.reactivex.flowable.Flowable<R> flatMapMaybe(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.MaybeSource<? extends R>> mapper)
public static <T,R> io.reactivex.flowable.Flowable<R> flatMapMaybe(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.MaybeSource<? extends R>> mapper,
boolean delayError,
int maxConcurrency)
public static <T> io.reactivex.observable.Completable flatMapCompletable(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.CompletableSource> mapper)
public static <T> io.reactivex.observable.Completable flatMapCompletable(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends io.reactivex.observable.CompletableSource> mapper,
boolean delayError,
int prefetch)
public static <T,R> io.reactivex.flowable.Flowable<R> flatMapPublisher(io.reactivex.observable.Single<T> source,
io.reactivex.common.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
public static <T,R> io.reactivex.flowable.Flowable<R> flatMapPublisher(io.reactivex.observable.Maybe<T> source,
io.reactivex.common.functions.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
public static <T,R> io.reactivex.flowable.Flowable<R> flattenAsFlowable(io.reactivex.observable.Single<T> source,
io.reactivex.common.functions.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
public static <T,R> io.reactivex.flowable.Flowable<R> flattenAsFlowable(io.reactivex.observable.Maybe<T> source,
io.reactivex.common.functions.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
public static <T> io.reactivex.observable.Completable concatCompletable(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources)
public static <T> io.reactivex.observable.Completable concatCompletable(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources,
int prefetch)
public static <T> io.reactivex.observable.Completable mergeCompletable(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources)
public static <T> io.reactivex.observable.Completable mergeCompletable(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources,
int maxConcurrency)
public static <T> io.reactivex.observable.Completable mergeCompletableDelayError(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources)
public static <T> io.reactivex.observable.Completable mergeCompletableDelayError(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.CompletableSource> sources,
int maxConcurrency)
public static <T> io.reactivex.flowable.Flowable<T> concatSingle(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Single<? extends T>> sources)
public static <T> io.reactivex.flowable.Flowable<T> concatSingle(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Single<? extends T>> sources,
int prefetch)
public static <T> io.reactivex.flowable.Flowable<T> concatMaybe(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Maybe<? extends T>> sources)
public static <T> io.reactivex.flowable.Flowable<T> concatMaybe(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Maybe<? extends T>> sources,
int prefetch)
public static <T,R> io.reactivex.flowable.Flowable<R> mergeSingle(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Single<? extends R>> sources)
public static <T,R> io.reactivex.flowable.Flowable<R> mergeMaybe(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Maybe<? extends R>> sources)
public static <T,R> io.reactivex.flowable.Flowable<R> mergeMaybe(io.reactivex.flowable.Flowable<? extends io.reactivex.observable.Maybe<? extends R>> sources,
int maxConcurrency)
public static <T> io.reactivex.observable.Single<T> first(io.reactivex.flowable.Flowable<T> source,
T defaultItem)
public static <T> io.reactivex.observable.Single<T> firstOrError(io.reactivex.flowable.Flowable<T> source)
public static <T> io.reactivex.observable.Maybe<T> firstElement(io.reactivex.flowable.Flowable<T> source)
public static <T> io.reactivex.observable.Single<T> last(io.reactivex.flowable.Flowable<T> source,
T defaultItem)
public static <T> io.reactivex.observable.Single<T> lastOrError(io.reactivex.flowable.Flowable<T> source)
public static <T> io.reactivex.observable.Maybe<T> lastElement(io.reactivex.flowable.Flowable<T> source)
public static <T> io.reactivex.observable.Single<T> single(io.reactivex.flowable.Flowable<T> source,
T defaultItem)
public static <T> io.reactivex.observable.Single<T> singleOrError(io.reactivex.flowable.Flowable<T> source)
public static <T> io.reactivex.observable.Maybe<T> singleElement(io.reactivex.flowable.Flowable<T> source)
public static <T> io.reactivex.observable.Maybe<T> elementAt(io.reactivex.flowable.Flowable<T> source,
long index)
public static <T> io.reactivex.observable.Single<T> elementAt(io.reactivex.flowable.Flowable<T> source,
long index,
T defaultItem)
public static <T> io.reactivex.observable.Single<T> elementAtOrError(io.reactivex.flowable.Flowable<T> source,
long index)
public static <T,C> io.reactivex.observable.Single<C> collect(io.reactivex.flowable.Flowable<T> source,
java.util.concurrent.Callable<C> collectionSupplier,
io.reactivex.common.functions.BiConsumer<? super C,? super T> collector)
public static <T> io.reactivex.observable.Single<java.lang.Boolean> any(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Predicate<? super T> predicate)
public static <T> io.reactivex.observable.Single<java.lang.Boolean> all(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Predicate<? super T> predicate)
public static <T> io.reactivex.observable.Single<java.lang.Boolean> isEmpty(io.reactivex.flowable.Flowable<T> source)
public static <T> io.reactivex.observable.Single<java.lang.Long> count(io.reactivex.flowable.Flowable<T> source)
@CheckReturnValue
@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="none")
public static <T,K> io.reactivex.observable.Single<java.util.Map<K,T>> toMap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector)
keySelector function.
If more than one source item maps to the same key, the HashMap will contain the latest of those items.
Publisher in an
unbounded manner (i.e., without applying backpressure to it).toMap does not operate by default on a particular Scheduler.K - the key type of the MapT - the source value typesource - the source Flowable instancekeySelector - the function that extracts the key from a source item to be used in the HashMap@CheckReturnValue
@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="none")
public static <T,K,V> io.reactivex.observable.Single<java.util.Map<K,V>> toMap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector,
io.reactivex.common.functions.Function<? super T,? extends V> valueSelector)
keySelector function.
If more than one source item maps to the same key, the HashMap will contain a single entry that corresponds to the latest of those items.
Publisher in an
unbounded manner (i.e., without applying backpressure to it).toMap does not operate by default on a particular Scheduler.K - the key type of the MapV - the value type of the MapT - the source value typesource - the source Flowable instancekeySelector - the function that extracts the key from a source item to be used in the HashMapvalueSelector - the function that extracts the value from a source item to be used in the HashMap@CheckReturnValue
@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="none")
public static <T,K,V> io.reactivex.observable.Single<java.util.Map<K,V>> toMap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector,
io.reactivex.common.functions.Function<? super T,? extends V> valueSelector,
java.util.concurrent.Callable<? extends java.util.Map<K,V>> mapSupplier)
mapFactory function, that
contains keys and values extracted from the items emitted by the source Publisher.
Publisher in an
unbounded manner (i.e., without applying backpressure to it).toMap does not operate by default on a particular Scheduler.K - the key type of the MapV - the value type of the MapT - the source value typesource - the source Flowable instancekeySelector - the function that extracts the key from a source item to be used in the MapvalueSelector - the function that extracts the value from the source items to be used as value in the MapmapSupplier - the function that returns a Map instance to be used@CheckReturnValue
@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="none")
public static <T,K> io.reactivex.observable.Single<java.util.Map<K,java.util.Collection<T>>> toMultimap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector)
keySelector function.
toMultimap does not operate by default on a particular Scheduler.K - the key type of the MapT - the source value typesource - the source Flowable instancekeySelector - the function that extracts the key from the source items to be used as key in the HashMap@CheckReturnValue
@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="none")
public static <T,K,V> io.reactivex.observable.Single<java.util.Map<K,java.util.Collection<V>>> toMultimap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector,
io.reactivex.common.functions.Function<? super T,? extends V> valueSelector)
valueSelector function from items emitted by the source Publisher, keyed by a
specified keySelector function.
Publisher in an
unbounded manner (i.e., without applying backpressure to it).toMultimap does not operate by default on a particular Scheduler.K - the key type of the MapV - the value type of the MapT - the source value typesource - the source Flowable instancekeySelector - the function that extracts a key from the source items to be used as key in the HashMapvalueSelector - the function that extracts a value from the source items to be used as value in the HashMap@CheckReturnValue
@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="none")
public static <T,K,V> io.reactivex.observable.Single<java.util.Map<K,java.util.Collection<V>>> toMultimap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector,
io.reactivex.common.functions.Function<? super T,? extends V> valueSelector,
java.util.concurrent.Callable<? extends java.util.Map<K,java.util.Collection<V>>> mapSupplier,
io.reactivex.common.functions.Function<? super K,? extends java.util.Collection<? super V>> collectionFactory)
mapFactory function, that
contains a custom collection of values, extracted by a specified valueSelector function from
items emitted by the source Publisher, and keyed by the keySelector function.
Publisher in an
unbounded manner (i.e., without applying backpressure to it).toMultimap does not operate by default on a particular Scheduler.K - the key type of the MapV - the value type of the MapT - the source value typesource - the source Flowable instancekeySelector - the function that extracts a key from the source items to be used as the key in the MapvalueSelector - the function that extracts a value from the source items to be used as the value in the MapmapSupplier - the function that returns a Map instance to be usedcollectionFactory - the function that returns a Collection instance for a particular key to be used in the Map@CheckReturnValue
@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="none")
public static <T,K,V> io.reactivex.observable.Single<java.util.Map<K,java.util.Collection<V>>> toMultimap(io.reactivex.flowable.Flowable<T> source,
io.reactivex.common.functions.Function<? super T,? extends K> keySelector,
io.reactivex.common.functions.Function<? super T,? extends V> valueSelector,
java.util.concurrent.Callable<java.util.Map<K,java.util.Collection<V>>> mapSupplier)
mapFactory function, that
contains an ArrayList of values, extracted by a specified valueSelector function from items
emitted by the source Publisher and keyed by the keySelector function.
Publisher in an
unbounded manner (i.e., without applying backpressure to it).toMultimap does not operate by default on a particular Scheduler.K - the key type of the MapV - the value type of the MapT - the source value typesource - the source Flowable instancekeySelector - the function that extracts a key from the source items to be used as the key in the MapvalueSelector - the function that extracts a value from the source items to be used as the value in the MapmapSupplier - the function that returns a Map instance to be used@CheckReturnValue @BackpressureSupport(value=UNBOUNDED_IN) @SchedulerSupport(value="none") public static <T> io.reactivex.observable.Single<java.util.List<T>> toSortedList(io.reactivex.flowable.Flowable<T> source)
Comparable with respect to all
other items in the sequence.
If any item emitted by this Flowable does not implement Comparable with respect to
all other items emitted by this Flowable, no items will be emitted and the
sequence is terminated with a ClassCastException.
Publisher in an
unbounded manner (i.e., without applying backpressure to it).toSortedList does not operate by default on a particular Scheduler.T - the source value typesource - the source Flowable instance@CheckReturnValue
@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="none")
public static <T> io.reactivex.observable.Single<java.util.List<T>> toSortedList(io.reactivex.flowable.Flowable<T> source,
java.util.Comparator<? super T> comparator)
Publisher in an
unbounded manner (i.e., without applying backpressure to it).toSortedList does not operate by default on a particular Scheduler.T - the source value typesource - the source Flowable instancecomparator - a function that compares two items emitted by the source Publisher and returns an Integer
that indicates their sort order@CheckReturnValue
@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="none")
public static <T> io.reactivex.observable.Single<java.util.List<T>> toSortedList(io.reactivex.flowable.Flowable<T> source,
java.util.Comparator<? super T> comparator,
int capacityHint)
Publisher in an
unbounded manner (i.e., without applying backpressure to it).toSortedList does not operate by default on a particular Scheduler.T - the source value typesource - the source Flowable instancecomparator - a function that compares two items emitted by the source Publisher and returns an Integer
that indicates their sort ordercapacityHint - the initial capacity of the ArrayList used to accumulate items before sorting@CheckReturnValue
@BackpressureSupport(value=UNBOUNDED_IN)
@SchedulerSupport(value="none")
public static <T> io.reactivex.observable.Single<java.util.List<T>> toSortedList(io.reactivex.flowable.Flowable<T> source,
int capacityHint)
Comparable with respect to all
other items in the sequence.
If any item emitted by this Flowable does not implement Comparable with respect to
all other items emitted by this Flowable, no items will be emitted and the
sequence is terminated with a ClassCastException.
Publisher in an
unbounded manner (i.e., without applying backpressure to it).toSortedList does not operate by default on a particular Scheduler.T - the source value typesource - the source Flowable instancecapacityHint - the initial capacity of the ArrayList used to accumulate items before sorting@NonNull
public static <S extends io.reactivex.common.Scheduler & io.reactivex.common.Disposable> S when(io.reactivex.common.Scheduler scheduler,
@NonNull
io.reactivex.common.functions.Function<io.reactivex.flowable.Flowable<io.reactivex.flowable.Flowable<io.reactivex.observable.Completable>>,io.reactivex.observable.Completable> combine)
Scheduler. The only parameter
is a function that flattens an Flowable of Flowable
of Completables into just one Completable. There must be
a chain of operators connecting the returned value to the source
Flowable otherwise any work scheduled on the returned
Scheduler will not be executed.
When Scheduler.createWorker() is invoked a Flowable of
Completables is onNext'd to the combinator to be flattened. If
the inner Flowable is not immediately subscribed to an calls to
Scheduler.Worker.schedule(java.lang.Runnable) are buffered. Once the Flowable is
subscribed to actions are then onNext'd as Completables.
Finally the actions scheduled on the parent Scheduler when the
inner most Completables are subscribed to.
When the Scheduler.Worker is unsubscribed the Completable emits an
onComplete and triggers any behavior in the flattening operator. The
Flowable and all Completables give to the flattening
function never onError.
Limit the amount concurrency two at a time without creating a new fix size thread pool:
Scheduler limitScheduler = Schedulers.computation().when(workers -> {
// use merge max concurrent to limit the number of concurrent
// callbacks two at a time
return Completable.merge(Flowable.merge(workers), 2);
});
This is a slightly different way to limit the concurrency but it has some
interesting benefits and drawbacks to the method above. It works by
limited the number of concurrent Scheduler.Workers rather than individual
actions. Generally each Flowable uses its own Scheduler.Worker.
This means that this will essentially limit the number of concurrent
subscribes. The danger comes from using operators like
Flowable.zip(org.reactivestreams.Publisher, org.reactivestreams.Publisher, io.reactivex.common.functions.BiFunction) where
subscribing to the first Flowable could deadlock the
subscription to the second.
Scheduler limitScheduler = Schedulers.computation().when(workers -> {
// use merge max concurrent to limit the number of concurrent
// Flowables two at a time
return Completable.merge(Flowable.merge(workers, 2));
});
Slowing down the rate to no more than than 1 a second. This suffers from
the same problem as the one above I could find an Flowable
operator that limits the rate without dropping the values (aka leaky
bucket algorithm).
Scheduler slowScheduler = Schedulers.computation().when(workers -> {
// use concatenate to make each worker happen one at a time.
return Completable.concat(workers.map(actions -> {
// delay the starting of the next worker by 1 second.
return Completable.merge(actions.delaySubscription(1, TimeUnit.SECONDS));
}));
});
S - a Scheduler and a Subscriptionscheduler - the target scheduler to wrapcombine - the function that takes a two-level nested Flowable sequence of a Completable and returns
the Completable that will be subscribed to and should trigger the execution of the scheduled Actions.public static <T,U> io.reactivex.observable.Single<T> takeUntil(io.reactivex.observable.Single<T> source,
org.reactivestreams.Publisher<U> other)
public static <T,U> io.reactivex.observable.Maybe<T> takeUntil(io.reactivex.observable.Maybe<T> source,
org.reactivestreams.Publisher<U> other)
public static <T,U> io.reactivex.observable.Maybe<T> timeout(io.reactivex.observable.Maybe<T> source,
org.reactivestreams.Publisher<U> other)
public static <T,U> io.reactivex.observable.Maybe<T> timeout(io.reactivex.observable.Maybe<T> source,
org.reactivestreams.Publisher<U> other,
io.reactivex.observable.Maybe<T> fallback)