@@ -1225,7 +1225,7 @@ public final static <T> Observable<T> from(T[] array) {
1225
1225
* @see <a href="http://reactivex.io/documentation/operators/interval.html">ReactiveX operators documentation: Interval</a>
1226
1226
*/
1227
1227
public final static Observable <Long > interval (long interval , TimeUnit unit ) {
1228
- return interval (interval , unit , Schedulers .computation ());
1228
+ return interval (interval , interval , unit , Schedulers .computation ());
1229
1229
}
1230
1230
1231
1231
/**
@@ -1248,7 +1248,63 @@ public final static Observable<Long> interval(long interval, TimeUnit unit) {
1248
1248
* @see <a href="http://reactivex.io/documentation/operators/interval.html">ReactiveX operators documentation: Interval</a>
1249
1249
*/
1250
1250
public final static Observable <Long > interval (long interval , TimeUnit unit , Scheduler scheduler ) {
1251
- return create (new OnSubscribeTimerPeriodically (interval , interval , unit , scheduler ));
1251
+ return interval (interval , interval , unit , scheduler );
1252
+ }
1253
+
1254
+ /**
1255
+ * Returns an Observable that emits a {@code 0L} after the {@code initialDelay} and ever increasing numbers
1256
+ * after each {@code period} of time thereafter.
1257
+ * <p>
1258
+ * <img width="640" height="200" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/timer.p.png" alt="">
1259
+ * <dl>
1260
+ * <dt><b>Backpressure Support:</b></dt>
1261
+ * <dd>This operator does not support backpressure as it uses time. If the downstream needs a slower rate
1262
+ * it should slow the timer or use something like {@link #onBackpressureDrop}.</dd>
1263
+ * <dt><b>Scheduler:</b></dt>
1264
+ * <dd>{@code timer} operates by default on the {@code computation} {@link Scheduler}.</dd>
1265
+ * </dl>
1266
+ *
1267
+ * @param initialDelay
1268
+ * the initial delay time to wait before emitting the first value of 0L
1269
+ * @param period
1270
+ * the period of time between emissions of the subsequent numbers
1271
+ * @param unit
1272
+ * the time unit for both {@code initialDelay} and {@code period}
1273
+ * @return an Observable that emits a 0L after the {@code initialDelay} and ever increasing numbers after
1274
+ * each {@code period} of time thereafter
1275
+ * @see <a href="http://reactivex.io/documentation/operators/timer.html">ReactiveX operators documentation: Timer</a>
1276
+ */
1277
+ public final static Observable <Long > interval (long initialDelay , long period , TimeUnit unit ) {
1278
+ return interval (initialDelay , period , unit , Schedulers .computation ());
1279
+ }
1280
+
1281
+ /**
1282
+ * Returns an Observable that emits a {@code 0L} after the {@code initialDelay} and ever increasing numbers
1283
+ * after each {@code period} of time thereafter, on a specified {@link Scheduler}.
1284
+ * <p>
1285
+ * <img width="640" height="200" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/timer.ps.png" alt="">
1286
+ * <dl>
1287
+ * <dt><b>Backpressure Support:</b></dt>
1288
+ * <dd>This operator does not support backpressure as it uses time. If the downstream needs a slower rate
1289
+ * it should slow the timer or use something like {@link #onBackpressureDrop}.</dd>
1290
+ * <dt><b>Scheduler:</b></dt>
1291
+ * <dd>you specify which {@link Scheduler} this operator will use</dd>
1292
+ * </dl>
1293
+ *
1294
+ * @param initialDelay
1295
+ * the initial delay time to wait before emitting the first value of 0L
1296
+ * @param period
1297
+ * the period of time between emissions of the subsequent numbers
1298
+ * @param unit
1299
+ * the time unit for both {@code initialDelay} and {@code period}
1300
+ * @param scheduler
1301
+ * the Scheduler on which the waiting happens and items are emitted
1302
+ * @return an Observable that emits a 0L after the {@code initialDelay} and ever increasing numbers after
1303
+ * each {@code period} of time thereafter, while running on the given Scheduler
1304
+ * @see <a href="http://reactivex.io/documentation/operators/timer.html">ReactiveX operators documentation: Timer</a>
1305
+ */
1306
+ public final static Observable <Long > interval (long initialDelay , long period , TimeUnit unit , Scheduler scheduler ) {
1307
+ return create (new OnSubscribeTimerPeriodically (initialDelay , period , unit , scheduler ));
1252
1308
}
1253
1309
1254
1310
/**
@@ -2441,57 +2497,17 @@ public final static <T> Observable<T> switchOnNext(Observable<? extends Observab
2441
2497
}
2442
2498
2443
2499
/**
2444
- * Returns an Observable that emits a {@code 0L} after the {@code initialDelay} and ever increasing numbers
2445
- * after each {@code period} of time thereafter.
2446
- * <p>
2447
- * <img width="640" height="200" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/timer.p.png" alt="">
2448
- * <dl>
2449
- * <dt><b>Backpressure Support:</b></dt>
2450
- * <dd>This operator does not support backpressure as it uses time. If the downstream needs a slower rate
2451
- * it should slow the timer or use something like {@link #onBackpressureDrop}.</dd>
2452
- * <dt><b>Scheduler:</b></dt>
2453
- * <dd>{@code timer} operates by default on the {@code computation} {@link Scheduler}.</dd>
2454
- * </dl>
2455
- *
2456
- * @param initialDelay
2457
- * the initial delay time to wait before emitting the first value of 0L
2458
- * @param period
2459
- * the period of time between emissions of the subsequent numbers
2460
- * @param unit
2461
- * the time unit for both {@code initialDelay} and {@code period}
2462
- * @return an Observable that emits a 0L after the {@code initialDelay} and ever increasing numbers after
2463
- * each {@code period} of time thereafter
2464
- * @see <a href="http://reactivex.io/documentation/operators/timer.html">ReactiveX operators documentation: Timer</a>
2500
+ * @deprecated use {@link #interval(long, long, TimeUnit)} instead
2465
2501
*/
2502
+ @ Deprecated
2466
2503
public final static Observable <Long > timer (long initialDelay , long period , TimeUnit unit ) {
2467
2504
return timer (initialDelay , period , unit , Schedulers .computation ());
2468
2505
}
2469
2506
2470
2507
/**
2471
- * Returns an Observable that emits a {@code 0L} after the {@code initialDelay} and ever increasing numbers
2472
- * after each {@code period} of time thereafter, on a specified {@link Scheduler}.
2473
- * <p>
2474
- * <img width="640" height="200" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/timer.ps.png" alt="">
2475
- * <dl>
2476
- * <dt><b>Backpressure Support:</b></dt>
2477
- * <dd>This operator does not support backpressure as it uses time. If the downstream needs a slower rate
2478
- * it should slow the timer or use something like {@link #onBackpressureDrop}.</dd>
2479
- * <dt><b>Scheduler:</b></dt>
2480
- * <dd>you specify which {@link Scheduler} this operator will use</dd>
2481
- * </dl>
2482
- *
2483
- * @param initialDelay
2484
- * the initial delay time to wait before emitting the first value of 0L
2485
- * @param period
2486
- * the period of time between emissions of the subsequent numbers
2487
- * @param unit
2488
- * the time unit for both {@code initialDelay} and {@code period}
2489
- * @param scheduler
2490
- * the Scheduler on which the waiting happens and items are emitted
2491
- * @return an Observable that emits a 0L after the {@code initialDelay} and ever increasing numbers after
2492
- * each {@code period} of time thereafter, while running on the given Scheduler
2493
- * @see <a href="http://reactivex.io/documentation/operators/timer.html">ReactiveX operators documentation: Timer</a>
2508
+ * @deprecated use {@link #interval(long, long, TimeUnit, Scheduler)} instead
2494
2509
*/
2510
+ @ Deprecated
2495
2511
public final static Observable <Long > timer (long initialDelay , long period , TimeUnit unit , Scheduler scheduler ) {
2496
2512
return create (new OnSubscribeTimerPeriodically (initialDelay , period , unit , scheduler ));
2497
2513
}
0 commit comments