@@ -5381,16 +5381,45 @@ public Observable<T> skip(int num) {
5381
5381
}
5382
5382
5383
5383
/**
5384
- * If the source Observable completes after emitting a single item, return
5385
- * an Observable that emits that item. If the source Observable emits more
5386
- * than one item or no items, throw an IllegalArgumentException.
5387
- * <p>
5388
- * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/single.png">
5384
+ * Create an Observable that skips values before the given time ellapses.
5385
+ *
5386
+ * @param time
5387
+ * the length of the time window
5388
+ * @param unit
5389
+ * the time unit
5390
+ * @return an Observable that skips values before the given time ellapses
5391
+ */
5392
+ public Observable <T > skip (long time , TimeUnit unit ) {
5393
+ return skip (time , unit , Schedulers .threadPoolForComputation ());
5394
+ }
5395
+
5396
+ /**
5397
+ * Create an Observable that skips values before the given time
5398
+ * elapses while waiting on the given scheduler.
5399
+ *
5400
+ * @param time
5401
+ * the length of the time window
5402
+ * @param unit
5403
+ * the time unit
5404
+ * @param scheduler
5405
+ * the scheduler where the timed wait happens
5406
+ * @return an Observable that skips values before the given time
5407
+ * elapses while waiting on the given scheduler
5408
+ */
5409
+ public Observable <T > skip (long time , TimeUnit unit , Scheduler scheduler ) {
5410
+ return create (new OperationSkip .SkipTimed <T >(this , time , unit , scheduler ));
5411
+ }
5412
+
5413
+ /**
5414
+ * If the Observable completes after emitting a single item, return an
5415
+ * Observable containing that item. If it emits more than one item or no
5416
+ * item, throw an IllegalArgumentException.
5389
5417
*
5390
5418
* @return an Observable that emits the single item emitted by the source
5391
5419
* Observable that matches the predicate
5392
- * @throws IllegalArgumentException if the source emits more than one item
5393
- * or no items
5420
+ * @throws IllegalArgumentException
5421
+ * if the source emits more than one item
5422
+ * or no items
5394
5423
* @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#single-and-singleordefault">RxJava Wiki: single()</a>
5395
5424
* @see MSDN: <code>Observable.singleAsync()</code>
5396
5425
*/
@@ -5575,6 +5604,31 @@ public Observable<T> take(final int num) {
5575
5604
return create (OperationTake .take (this , num ));
5576
5605
}
5577
5606
5607
+ /**
5608
+ * Create an Observable that takes the emitted values of the source
5609
+ * Observable before the time runs out.
5610
+ * @param time the length of the time window
5611
+ * @param unit the time unit
5612
+ * @return an Observable that takes the emitted values of the source
5613
+ * Observable before the time runs out.
5614
+ */
5615
+ public Observable <T > take (long time , TimeUnit unit ) {
5616
+ return take (time , unit , Schedulers .threadPoolForComputation ());
5617
+ }
5618
+
5619
+ /**
5620
+ * Create an Observable that takes the emitted values of the source
5621
+ * Observable before the time runs out, waiting on the given scheduler.
5622
+ * @param time the length of the time window
5623
+ * @param unit the time unit
5624
+ * @param scheduler the scheduler used for time source
5625
+ * @return an Observable that takes the emitted values of the source
5626
+ * Observable before the time runs out, waiting on the given scheduler.
5627
+ */
5628
+ public Observable <T > take (long time , TimeUnit unit , Scheduler scheduler ) {
5629
+ return create (new OperationTake .TakeTimed <T >(this , time , unit , scheduler ));
5630
+ }
5631
+
5578
5632
/**
5579
5633
* Returns an Observable that emits items emitted by the source Observable
5580
5634
* so long as a specified condition is true.
@@ -5917,6 +5971,31 @@ public Observable<T> skipLast(int count) {
5917
5971
return create (OperationSkipLast .skipLast (this , count ));
5918
5972
}
5919
5973
5974
+ /**
5975
+ * Create an observable which skips values emitted in a time window
5976
+ * before the source completes.
5977
+ * @param time the length of the time window
5978
+ * @param unit the time unit
5979
+ * @return an observable which skips values emitted in a time window
5980
+ * before the source completes
5981
+ */
5982
+ public Observable <T > skipLast (long time , TimeUnit unit ) {
5983
+ return skipLast (time , unit , Schedulers .threadPoolForComputation ());
5984
+ }
5985
+
5986
+ /**
5987
+ * Create an observable which skips values emitted in a time window
5988
+ * before the source completes by using the given scheduler as time source.
5989
+ * @param time the length of the time window
5990
+ * @param unit the time unit
5991
+ * @param scheduler the scheduler used for time source
5992
+ * @return an observable which skips values emitted in a time window
5993
+ * before the source completes by using the given scheduler as time source
5994
+ */
5995
+ public Observable <T > skipLast (long time , TimeUnit unit , Scheduler scheduler ) {
5996
+ return create (new OperationSkipLast .SkipLastTimed <T >(this , time , unit , scheduler ));
5997
+ }
5998
+
5920
5999
/**
5921
6000
* Returns an Observable that emits a single item, a list composed of all
5922
6001
* the items emitted by the source Observable.
0 commit comments