From 6efed6f6a0d0a1f6c7731ac8098db22b19c79cf4 Mon Sep 17 00:00:00 2001 From: akarnokd Date: Thu, 28 Nov 2019 12:13:56 +0100 Subject: [PATCH] 3.x: Add Maybe marble diagrams (14 cases) --- .../java/io/reactivex/rxjava3/core/Maybe.java | 74 ++++++++++++------- 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/src/main/java/io/reactivex/rxjava3/core/Maybe.java b/src/main/java/io/reactivex/rxjava3/core/Maybe.java index 16df7fb908..9bcf753e85 100644 --- a/src/main/java/io/reactivex/rxjava3/core/Maybe.java +++ b/src/main/java/io/reactivex/rxjava3/core/Maybe.java @@ -1817,13 +1817,13 @@ public static Maybe wrap(MaybeSource source) { * Returns a Maybe that emits the results of a specified combiner function applied to combinations of * items emitted, in sequence, by an Iterable of other MaybeSources. *

+ * + *

* 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}. - * *

- * - *

This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This + * This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This * also means it is possible some sources may not get subscribed to at all. *

*
Scheduler:
@@ -1853,8 +1853,9 @@ public static Maybe zip(Iterable> s * Returns a Maybe that emits the results of a specified combiner function applied to combinations of * two items emitted, in sequence, by two other MaybeSources. *

- * - *

This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This + * + *

+ * This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This * also means it is possible some sources may not get subscribed to at all. *

*
Scheduler:
@@ -1890,8 +1891,9 @@ public static Maybe zip( * Returns a Maybe that emits the results of a specified combiner function applied to combinations of * three items emitted, in sequence, by three other MaybeSources. *

- * - *

This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This + * + *

+ * This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This * also means it is possible some sources may not get subscribed to at all. *

*
Scheduler:
@@ -1931,8 +1933,9 @@ public static Maybe zip( * Returns a Maybe that emits the results of a specified combiner function applied to combinations of * four items emitted, in sequence, by four other MaybeSources. *

- * - *

This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This + * + *

+ * This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This * also means it is possible some sources may not get subscribed to at all. *

*
Scheduler:
@@ -1977,8 +1980,9 @@ public static Maybe zip( * Returns a Maybe that emits the results of a specified combiner function applied to combinations of * five items emitted, in sequence, by five other MaybeSources. *

- * - *

This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This + * + *

+ * This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This * also means it is possible some sources may not get subscribed to at all. *

*
Scheduler:
@@ -2027,8 +2031,9 @@ public static Maybe zip( * Returns a Maybe that emits the results of a specified combiner function applied to combinations of * six items emitted, in sequence, by six other MaybeSources. *

- * - *

This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This + * + *

+ * This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This * also means it is possible some sources may not get subscribed to at all. *

*
Scheduler:
@@ -2081,8 +2086,9 @@ public static Maybe zip( * Returns a Maybe that emits the results of a specified combiner function applied to combinations of * seven items emitted, in sequence, by seven other MaybeSources. *

- * - *

This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This + * + *

+ * This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This * also means it is possible some sources may not get subscribed to at all. *

*
Scheduler:
@@ -2140,8 +2146,9 @@ public static Maybe zip( * Returns a Maybe that emits the results of a specified combiner function applied to combinations of * eight items emitted, in sequence, by eight other MaybeSources. *

- * - *

This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This + * + *

+ * This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This * also means it is possible some sources may not get subscribed to at all. *

*
Scheduler:
@@ -2203,14 +2210,14 @@ public static Maybe zip( * Returns a Maybe that emits the results of a specified combiner function applied to combinations of * nine items emitted, in sequence, by nine other MaybeSources. *

- * + * + *

+ * This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This + * also means it is possible some sources may not get subscribed to at all. *

*
Scheduler:
*
{@code zip} does not operate by default on a particular {@link Scheduler}.
*
- *

This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This - * also means it is possible some sources may not get subscribed to at all. - * * @param the value type of the first source * @param the value type of the second source * @param the value type of the third source @@ -2276,7 +2283,7 @@ public static Maybe zip( * {@code Function} passed to the method would trigger a {@code ClassCastException}. * *

- * + * *

This operator terminates eagerly if any of the source MaybeSources signal an onError or onComplete. This * also means it is possible some sources may not get subscribed to at all. *

@@ -2408,6 +2415,8 @@ public final Maybe cache() { /** * Casts the success value of the current Maybe into the target type or signals a * ClassCastException if not compatible. + *

+ * *

*
Scheduler:
*
{@code cast} does not operate by default on a particular {@link Scheduler}.
@@ -2504,7 +2513,7 @@ public final Flowable concatWith(MaybeSource other) { * Returns a Single that emits a Boolean that indicates whether the source Maybe emitted a * specified item. *

- * + * *

*
Scheduler:
*
{@code contains} does not operate by default on a particular {@link Scheduler}.
@@ -2537,7 +2546,6 @@ public final Single contains(final Object item) { * @return a Single that emits a single item: the number of items emitted by the source Maybe as a * 64-bit Long item * @see ReactiveX operators documentation: Count - * @see #count() */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @@ -2585,6 +2593,7 @@ public final Single defaultIfEmpty(T defaultItem) { * the {@link TimeUnit} in which {@code period} is defined * @return the new Maybe instance * @see ReactiveX operators documentation: Delay + * @see #delay(long, TimeUnit, Scheduler) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @@ -2654,6 +2663,8 @@ public final Maybe delay(Publisher delayIndicator) { /** * Returns a Maybe that delays the subscription to this Maybe * until the other Publisher emits an element or completes normally. + *

+ * *

*
Backpressure:
*
The {@code Publisher} source is consumed in an unbounded fashion (without applying backpressure).
@@ -2679,7 +2690,7 @@ public final Maybe delaySubscription(Publisher subscriptionIndicator) /** * Returns a Maybe that delays the subscription to the source Maybe by a given amount of time. *

- * + * *

*
Scheduler:
*
This version of {@code delaySubscription} operates by default on the {@code computation} {@link Scheduler}.
@@ -2691,6 +2702,7 @@ public final Maybe delaySubscription(Publisher subscriptionIndicator) * the time unit of {@code delay} * @return a Maybe that delays the subscription to the source Maybe by the given amount * @see ReactiveX operators documentation: Delay + * @see #delaySubscription(long, TimeUnit, Scheduler) */ @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) @@ -2702,7 +2714,7 @@ public final Maybe delaySubscription(long delay, TimeUnit unit) { * Returns a Maybe that delays the subscription to the source Maybe by a given amount of time, * both waiting and subscribing on a given Scheduler. *

- * + * *

*
Scheduler:
*
You specify which {@link Scheduler} this operator will use.
@@ -2884,6 +2896,8 @@ public final Maybe doOnError(Consumer onError) { * an onError or (null, null) for an onComplete signal from this Maybe before delivering said * signal to the downstream. *

+ * + *

* Exceptions thrown from the callback will override the event so the downstream receives the * error instead of the original signal. *

@@ -3342,6 +3356,8 @@ public final Single isEmpty() { * and providing a new {@code MaybeObserver}, containing the custom operator's intended business logic, that will be * used in the subscription process going further upstream. *

+ * + *

* Generally, such a new {@code MaybeObserver} will wrap the downstream's {@code MaybeObserver} and forwards the * {@code onSuccess}, {@code onError} and {@code onComplete} events from the upstream directly or according to the * emission pattern the custom operator's business logic requires. In addition, such operator can intercept the @@ -3862,6 +3878,8 @@ public final Maybe onExceptionResumeNext(final MaybeSource next) /** * Nulls out references to the upstream producer and downstream MaybeObserver if * the sequence is terminated or downstream calls dispose(). + *

+ * *

*
Scheduler:
*
{@code onTerminateDetach} does not operate by default on a particular {@link Scheduler}.
@@ -4680,6 +4698,8 @@ public final Maybe timeout(Publisher timeoutIndicator, MaybeSource + * *
*
Scheduler:
*
{@code unsubscribeOn} calls dispose() of the upstream on the {@link Scheduler} you specify.
@@ -4700,7 +4720,7 @@ public final Maybe unsubscribeOn(final Scheduler scheduler) { * Waits until this and the other MaybeSource signal a success value then applies the given BiFunction * to those values and emits the BiFunction's resulting value to downstream. * - * + * * *

If either this or the other MaybeSource is empty or signals an error, the resulting Maybe will * terminate immediately and dispose the other source.