Skip to content

Commit 3562dfc

Browse files
UMFsimkeakarnokd
authored andcommitted
Add marble diagrams for various Single operators (#6141)
1 parent 579e90d commit 3562dfc

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

src/main/java/io/reactivex/Single.java

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,8 @@ public static <T> Flowable<T> concatArrayEager(SingleSource<? extends T>... sour
414414
/**
415415
* Concatenates a Publisher sequence of SingleSources eagerly into a single stream of values.
416416
* <p>
417+
* <img width="640" height="307" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.concatEager.p.png" alt="">
418+
* <p>
417419
* Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
418420
* emitted source Publishers as they are observed. The operator buffers the values emitted by these
419421
* Publishers and then drains them in order, each one after the previous one completes.
@@ -439,6 +441,8 @@ public static <T> Flowable<T> concatEager(Publisher<? extends SingleSource<? ext
439441
/**
440442
* Concatenates a sequence of SingleSources eagerly into a single stream of values.
441443
* <p>
444+
* <img width="640" height="319" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.concatEager.i.png" alt="">
445+
* <p>
442446
* Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
443447
* source SingleSources. The operator buffers the values emitted by these SingleSources and then drains them
444448
* in order, each one after the previous one completes.
@@ -462,6 +466,8 @@ public static <T> Flowable<T> concatEager(Iterable<? extends SingleSource<? exte
462466
/**
463467
* Provides an API (via a cold Completable) that bridges the reactive world with the callback-style world.
464468
* <p>
469+
* <img width="640" height="454" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.create.png" alt="">
470+
* <p>
465471
* Example:
466472
* <pre><code>
467473
* Single.&lt;Event&gt;create(emitter -&gt; {
@@ -808,6 +814,8 @@ public static <T> Single<T> just(final T item) {
808814
/**
809815
* Merges an Iterable sequence of SingleSource instances into a single Flowable sequence,
810816
* running all SingleSources at once.
817+
* <p>
818+
* <img width="640" height="319" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.merge.i.png" alt="">
811819
* <dl>
812820
* <dt><b>Backpressure:</b></dt>
813821
* <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
@@ -843,6 +851,8 @@ public static <T> Flowable<T> merge(Iterable<? extends SingleSource<? extends T>
843851
/**
844852
* Merges a Flowable sequence of SingleSource instances into a single Flowable sequence,
845853
* running all SingleSources at once.
854+
* <p>
855+
* <img width="640" height="307" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.merge.p.png" alt="">
846856
* <dl>
847857
* <dt><b>Backpressure:</b></dt>
848858
* <dd>The returned {@code Flowable} honors the backpressure of the downstream consumer.</dd>
@@ -881,7 +891,7 @@ public static <T> Flowable<T> merge(Publisher<? extends SingleSource<? extends T
881891
* Flattens a {@code Single} that emits a {@code Single} into a single {@code Single} that emits the item
882892
* emitted by the nested {@code Single}, without any transformation.
883893
* <p>
884-
* <img width="640" height="370" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.merge.oo.png" alt="">
894+
* <img width="640" height="412" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.merge.oo.png" alt="">
885895
* <dl>
886896
* <dt><b>Scheduler:</b></dt>
887897
* <dd>{@code merge} does not operate by default on a particular {@link Scheduler}.</dd>
@@ -910,7 +920,7 @@ public static <T> Single<T> merge(SingleSource<? extends SingleSource<? extends
910920
/**
911921
* Flattens two Singles into a single Flowable, without any transformation.
912922
* <p>
913-
* <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.merge.png" alt="">
923+
* <img width="640" height="414" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.merge.png" alt="">
914924
* <p>
915925
* You can combine items emitted by multiple Singles so that they appear as a single Flowable, by
916926
* using the {@code merge} method.
@@ -958,7 +968,7 @@ public static <T> Flowable<T> merge(
958968
/**
959969
* Flattens three Singles into a single Flowable, without any transformation.
960970
* <p>
961-
* <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.merge.png" alt="">
971+
* <img width="640" height="366" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.merge.o3.png" alt="">
962972
* <p>
963973
* You can combine items emitted by multiple Singles so that they appear as a single Flowable, by using
964974
* the {@code merge} method.
@@ -1010,7 +1020,7 @@ public static <T> Flowable<T> merge(
10101020
/**
10111021
* Flattens four Singles into a single Flowable, without any transformation.
10121022
* <p>
1013-
* <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.merge.png" alt="">
1023+
* <img width="640" height="362" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.merge.o4.png" alt="">
10141024
* <p>
10151025
* You can combine items emitted by multiple Singles so that they appear as a single Flowable, by using
10161026
* the {@code merge} method.
@@ -1299,6 +1309,8 @@ public static Single<Long> timer(final long delay, final TimeUnit unit, final Sc
12991309

13001310
/**
13011311
* Compares two SingleSources and emits true if they emit the same value (compared via Object.equals).
1312+
* <p>
1313+
* <img width="640" height="465" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.equals.png" alt="">
13021314
* <dl>
13031315
* <dt><b>Scheduler:</b></dt>
13041316
* <dd>{@code equals} does not operate by default on a particular {@link Scheduler}.</dd>
@@ -1913,6 +1925,8 @@ public static <T, R> Single<R> zipArray(Function<? super Object[], ? extends R>
19131925

19141926
/**
19151927
* Signals the event of this or the other SingleSource whichever signals first.
1928+
* <p>
1929+
* <img width="640" height="463" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.ambWith.png" alt="">
19161930
* <dl>
19171931
* <dt><b>Scheduler:</b></dt>
19181932
* <dd>{@code ambWith} does not operate by default on a particular {@link Scheduler}.</dd>
@@ -1933,6 +1947,8 @@ public final Single<T> ambWith(SingleSource<? extends T> other) {
19331947
/**
19341948
* Calls the specified converter function during assembly time and returns its resulting value.
19351949
* <p>
1950+
* <img width="640" height="553" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.as.png" alt="">
1951+
* <p>
19361952
* This allows fluent conversion to any other type.
19371953
* <dl>
19381954
* <dt><b>Scheduler:</b></dt>
@@ -1972,6 +1988,8 @@ public final Single<T> hide() {
19721988
/**
19731989
* Transform a Single by applying a particular Transformer function to it.
19741990
* <p>
1991+
* <img width="640" height="612" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.compose.png" alt="">
1992+
* <p>
19751993
* This method operates on the Single itself whereas {@link #lift} operates on the Single's SingleObservers.
19761994
* <p>
19771995
* If the operator you are creating is designed to act on the individual item emitted by a Single, use
@@ -2281,7 +2299,10 @@ public final Single<T> delaySubscription(long time, TimeUnit unit, Scheduler sch
22812299

22822300
/**
22832301
* Calls the specified consumer with the success item after this item has been emitted to the downstream.
2284-
* <p>Note that the {@code doAfterSuccess} action is shared between subscriptions and as such
2302+
* <p>
2303+
* <img width="640" height="460" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.doAfterSuccess.png" alt="">
2304+
* <p>
2305+
* Note that the {@code doAfterSuccess} action is shared between subscriptions and as such
22852306
* should be thread-safe.
22862307
* <dl>
22872308
* <dt><b>Scheduler:</b></dt>
@@ -2301,10 +2322,12 @@ public final Single<T> doAfterSuccess(Consumer<? super T> onAfterSuccess) {
23012322

23022323
/**
23032324
* Registers an {@link Action} to be called after this Single invokes either onSuccess or onError.
2304-
* * <p>Note that the {@code doAfterTerminate} action is shared between subscriptions and as such
2305-
* should be thread-safe.</p>
23062325
* <p>
2307-
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doAfterTerminate.png" alt="">
2326+
* <img width="640" height="460" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.doAfterTerminate.png" alt="">
2327+
* <p>
2328+
* Note that the {@code doAfterTerminate} action is shared between subscriptions and as such
2329+
* should be thread-safe.</p>
2330+
*
23082331
* <dl>
23092332
* <dt><b>Scheduler:</b></dt>
23102333
* <dd>{@code doAfterTerminate} does not operate by default on a particular {@link Scheduler}.</dd>
@@ -2884,7 +2907,7 @@ public final Single<Boolean> contains(final Object value, final BiPredicate<Obje
28842907
/**
28852908
* Flattens this and another Single into a single Flowable, without any transformation.
28862909
* <p>
2887-
* <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.merge.png" alt="">
2910+
* <img width="640" height="415" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.mergeWith.png" alt="">
28882911
* <p>
28892912
* You can combine items emitted by multiple Singles so that they appear as a single Flowable, by using
28902913
* the {@code mergeWith} method.
@@ -3654,6 +3677,8 @@ private Single<T> timeout0(final long timeout, final TimeUnit unit, final Schedu
36543677
/**
36553678
* Calls the specified converter function with the current Single instance
36563679
* during assembly time and returns its result.
3680+
* <p>
3681+
* <img width="640" height="553" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.to.png" alt="">
36573682
* <dl>
36583683
* <dt><b>Scheduler:</b></dt>
36593684
* <dd>{@code to} does not operate by default on a particular {@link Scheduler}.</dd>

0 commit comments

Comments
 (0)