@@ -2672,6 +2672,7 @@ public final Single<T> defaultIfEmpty(@NonNull T defaultItem) {
2672
2672
/**
2673
2673
* Returns a {@code Maybe} that signals the events emitted by the current {@code Maybe} shifted forward in time by a
2674
2674
* specified delay.
2675
+ * An error signal will not be delayed.
2675
2676
* <p>
2676
2677
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/delay.png" alt="">
2677
2678
* <dl>
@@ -2682,17 +2683,68 @@ public final Single<T> defaultIfEmpty(@NonNull T defaultItem) {
2682
2683
* @param time
2683
2684
* the delay to shift the source by
2684
2685
* @param unit
2685
- * the {@link TimeUnit} in which {@code period } is defined
2686
+ * the {@link TimeUnit} in which {@code time } is defined
2686
2687
* @return the new {@code Maybe} instance
2687
2688
* @throws NullPointerException if {@code unit} is {@code null}
2688
2689
* @see <a href="http://reactivex.io/documentation/operators/delay.html">ReactiveX operators documentation: Delay</a>
2689
- * @see #delay(long, TimeUnit, Scheduler)
2690
+ * @see #delay(long, TimeUnit, Scheduler, boolean )
2690
2691
*/
2691
2692
@ CheckReturnValue
2692
2693
@ SchedulerSupport (SchedulerSupport .COMPUTATION )
2693
2694
@ NonNull
2694
2695
public final Maybe <T > delay (long time , @ NonNull TimeUnit unit ) {
2695
- return delay (time , unit , Schedulers .computation ());
2696
+ return delay (time , unit , Schedulers .computation (), false );
2697
+ }
2698
+
2699
+ /**
2700
+ * Returns a {@code Maybe} that signals the events emitted by the current {@code Maybe} shifted forward in time by a
2701
+ * specified delay.
2702
+ * <p>
2703
+ * <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/delay.png" alt="">
2704
+ * <dl>
2705
+ * <dt><b>Scheduler:</b></dt>
2706
+ * <dd>This version of {@code delay} operates by default on the {@code computation} {@link Scheduler}.</dd>
2707
+ * </dl>
2708
+ *
2709
+ * @param time the delay to shift the source by
2710
+ * @param unit the {@link TimeUnit} in which {@code time} is defined
2711
+ * @param delayError if {@code true}, both success and error signals are delayed. if {@code false}, only success signals are delayed.
2712
+ * @return the new {@code Maybe} instance
2713
+ * @throws NullPointerException if {@code unit} is {@code null}
2714
+ * @see <a href="http://reactivex.io/documentation/operators/delay.html">ReactiveX operators documentation: Delay</a>
2715
+ * @see #delay(long, TimeUnit, Scheduler, boolean)
2716
+ */
2717
+ @ CheckReturnValue
2718
+ @ SchedulerSupport (SchedulerSupport .COMPUTATION )
2719
+ @ NonNull
2720
+ public final Maybe <T > delay (long time , @ NonNull TimeUnit unit , boolean delayError ) {
2721
+ return delay (time , unit , Schedulers .computation (), delayError );
2722
+ }
2723
+
2724
+ /**
2725
+ * Returns a {@code Maybe} that signals the events emitted by the current {@code Maybe} shifted forward in time by a
2726
+ * specified delay.
2727
+ * An error signal will not be delayed.
2728
+ * <p>
2729
+ * <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/delay.png" alt="">
2730
+ * <dl>
2731
+ * <dt><b>Scheduler:</b></dt>
2732
+ * <dd>you specify the {@link Scheduler} where the non-blocking wait and emission happens</dd>
2733
+ * </dl>
2734
+ *
2735
+ * @param time the delay to shift the source by
2736
+ * @param unit the {@link TimeUnit} in which {@code time} is defined
2737
+ * @param scheduler the {@code Scheduler} to use for delaying
2738
+ * @return the new {@code Maybe} instance
2739
+ * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null}
2740
+ * @see <a href="http://reactivex.io/documentation/operators/delay.html">ReactiveX operators documentation: Delay</a>
2741
+ * @see #delay(long, TimeUnit, Scheduler, boolean)
2742
+ */
2743
+ @ CheckReturnValue
2744
+ @ SchedulerSupport (SchedulerSupport .CUSTOM )
2745
+ @ NonNull
2746
+ public final Maybe <T > delay (long time , @ NonNull TimeUnit unit , @ NonNull Scheduler scheduler ) {
2747
+ return delay (time , unit , scheduler , false );
2696
2748
}
2697
2749
2698
2750
/**
@@ -2708,20 +2760,21 @@ public final Maybe<T> delay(long time, @NonNull TimeUnit unit) {
2708
2760
* @param time
2709
2761
* the delay to shift the source by
2710
2762
* @param unit
2711
- * the time unit of {@code delay}
2763
+ * the {@link TimeUnit} in which {@code time} is defined
2712
2764
* @param scheduler
2713
2765
* the {@code Scheduler} to use for delaying
2766
+ * @param delayError if {@code true}, both success and error signals are delayed. if {@code false}, only success signals are delayed.
2714
2767
* @return the new {@code Maybe} instance
2715
2768
* @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null}
2716
2769
* @see <a href="http://reactivex.io/documentation/operators/delay.html">ReactiveX operators documentation: Delay</a>
2717
2770
*/
2718
2771
@ CheckReturnValue
2719
2772
@ NonNull
2720
2773
@ SchedulerSupport (SchedulerSupport .CUSTOM )
2721
- public final Maybe <T > delay (long time , @ NonNull TimeUnit unit , @ NonNull Scheduler scheduler ) {
2774
+ public final Maybe <T > delay (long time , @ NonNull TimeUnit unit , @ NonNull Scheduler scheduler , boolean delayError ) {
2722
2775
Objects .requireNonNull (unit , "unit is null" );
2723
2776
Objects .requireNonNull (scheduler , "scheduler is null" );
2724
- return RxJavaPlugins .onAssembly (new MaybeDelay <>(this , Math .max (0L , time ), unit , scheduler ));
2777
+ return RxJavaPlugins .onAssembly (new MaybeDelay <>(this , Math .max (0L , time ), unit , scheduler , delayError ));
2725
2778
}
2726
2779
2727
2780
/**
0 commit comments