@@ -2253,6 +2253,31 @@ public Observable<T> delay(long delay, TimeUnit unit, Scheduler scheduler) {
2253
2253
return OperationDelay .delay (this , delay , unit , scheduler );
2254
2254
}
2255
2255
2256
+ /**
2257
+ * Return an Observable which delays the subscription to this Observable sequence
2258
+ * by the given amount.
2259
+ * @param delay the time to delay the subscription
2260
+ * @param unit the time unit
2261
+ * @return an Observable which delays the subscription to this Observable sequence
2262
+ * by the given amount.
2263
+ */
2264
+ public Observable <T > delaySubscription (long delay , TimeUnit unit ) {
2265
+ return delaySubscription (delay , unit , Schedulers .threadPoolForComputation ());
2266
+ }
2267
+
2268
+ /**
2269
+ * Return an Observable which delays the subscription to this Observable sequence
2270
+ * by the given amount, waiting and subscribing on the given scheduler.
2271
+ * @param delay the time to delay the subscription
2272
+ * @param unit the time unit
2273
+ * @param scheduler the scheduler where the waiting and subscription will happen
2274
+ * @return an Observable which delays the subscription to this Observable sequence
2275
+ * by the given amount, waiting and subscribing on the given scheduler
2276
+ */
2277
+ public Observable <T > delaySubscription (long delay , TimeUnit unit , Scheduler scheduler ) {
2278
+ return create (OperationDelay .delaySubscription (this , delay , unit , scheduler ));
2279
+ }
2280
+
2256
2281
/**
2257
2282
* Drops items emitted by an Observable that are followed by newer items
2258
2283
* before a timeout value expires. The timer resets on each emission.
@@ -5489,6 +5514,148 @@ public Observable<T> takeLast(final int count) {
5489
5514
return create (OperationTakeLast .takeLast (this , count ));
5490
5515
}
5491
5516
5517
+ /**
5518
+ * Return an Observable which contains the items from this observable which
5519
+ * were emitted not before this completed minus a time window.
5520
+ *
5521
+ * @param time the length of the time window, relative to the completion of this
5522
+ * observable.
5523
+ * @param unit the time unit
5524
+ * @return an Observable which contains the items from this observable which
5525
+ * were emitted not before this completed minus a time window.
5526
+ */
5527
+ public Observable <T > takeLast (long time , TimeUnit unit ) {
5528
+ return takeLast (time , unit , Schedulers .threadPoolForComputation ());
5529
+ }
5530
+
5531
+ /**
5532
+ * Return an Observable which contains the items from this observable which
5533
+ * were emitted not before this completed minus a time window, where the timing
5534
+ * information is provided by the given scheduler.
5535
+ *
5536
+ * @param time the length of the time window, relative to the completion of this
5537
+ * observable.
5538
+ * @param unit the time unit
5539
+ * @param scheduler the scheduler which provides the timestamps for the observed
5540
+ * elements
5541
+ * @return an Observable which contains the items from this observable which
5542
+ * were emitted not before this completed minus a time window, where the timing
5543
+ * information is provided by the given scheduler
5544
+ */
5545
+ public Observable <T > takeLast (long time , TimeUnit unit , Scheduler scheduler ) {
5546
+ return create (OperationTakeLast .takeLast (this , time , unit , scheduler ));
5547
+ }
5548
+
5549
+ /**
5550
+ * Return an Observable which contains at most count items from this Observable
5551
+ * which were emitted not before this completed minus a time window.
5552
+ *
5553
+ * @param count the maximum number of items to return
5554
+ * @param time the length of the time window, relative to the completion of this
5555
+ * observable.
5556
+ * @param unit the time unit
5557
+ * @return Return an Observable which contains at most count items from this Observable
5558
+ * which were emitted not before this completed minus a time window.
5559
+ */
5560
+ public Observable <T > takeLast (int count , long time , TimeUnit unit ) {
5561
+ return takeLast (count , time , unit , Schedulers .threadPoolForComputation ());
5562
+ }
5563
+
5564
+ /**
5565
+ * Return an Observable which contains at most count items from this Observable
5566
+ * which were emitted not before this completed minus a time window, where the timing
5567
+ * information is provided by the given scheduler.
5568
+ *
5569
+ * @param count the maximum number of items to return
5570
+ * @param time the length of the time window, relative to the completion of this
5571
+ * observable.
5572
+ * @param unit the time unit
5573
+ * @param scheduler the scheduler which provides the timestamps for the observed
5574
+ * elements
5575
+ * @return Return an Observable which contains at most count items from this Observable
5576
+ * which were emitted not before this completed minus a time window, where the timing
5577
+ * information is provided by the given scheduler
5578
+ */
5579
+ public Observable <T > takeLast (int count , long time , TimeUnit unit , Scheduler scheduler ) {
5580
+ if (count < 0 ) {
5581
+ throw new IllegalArgumentException ("count >= 0 required" );
5582
+ }
5583
+ return create (OperationTakeLast .takeLast (this , count , time , unit , scheduler ));
5584
+ }
5585
+
5586
+ /**
5587
+ * Return an Observable which emits single List containing the last count
5588
+ * elements from this Observable.
5589
+ *
5590
+ * @param count the number of items to take last
5591
+ * @return an Observable which emits single list containing the last count
5592
+ * elements from this Observable.
5593
+ */
5594
+ public Observable <List <T >> takeLastBuffer (int count ) {
5595
+ return takeLast (count ).toList ();
5596
+ }
5597
+
5598
+ /**
5599
+ * Return an Observable which emits single List containing items which
5600
+ * were emitted not before this completed minus a time window.
5601
+ * @param time the length of the time window, relative to the completion of this
5602
+ * observable.
5603
+ * @param unit the time unit
5604
+ * @return an Observable which emits single list containing items which
5605
+ * were emitted not before this completed minus a time window
5606
+ */
5607
+ public Observable <List <T >> takeLastBuffer (long time , TimeUnit unit ) {
5608
+ return takeLast (time , unit ).toList ();
5609
+ }
5610
+
5611
+ /**
5612
+ * Return an Observable which emits single List containing items which
5613
+ * were emitted not before this completed minus a time window, where the timing
5614
+ * information is provided by the given scheduler.
5615
+ * @param time the length of the time window, relative to the completion of this
5616
+ * observable.
5617
+ * @param unit the time unit
5618
+ * @param scheduler the scheduler which provides the timestamps for the observed
5619
+ * elements
5620
+ * @return an Observable which emits single list containing items which
5621
+ * were emitted not before this completed minus a time window, where the timing
5622
+ * information is provided by the given scheduler
5623
+ */
5624
+ public Observable <List <T >> takeLastBuffer (long time , TimeUnit unit , Scheduler scheduler ) {
5625
+ return takeLast (time , unit , scheduler ).toList ();
5626
+ }
5627
+
5628
+ /**
5629
+ * Return an Observable which emits a single List containing at most count items
5630
+ * from this Observable which were emitted not before this completed minus a time window.
5631
+ * @param count the number of items to take last
5632
+ * @param time the length of the time window, relative to the completion of this
5633
+ * observable.
5634
+ * @param unit the time unit
5635
+ * @return an Observable which emits a single List containing at most count items
5636
+ * from this Observable which were emitted not before this completed minus a time window.
5637
+ */
5638
+ public Observable <List <T >> takeLastBuffer (int count , long time , TimeUnit unit ) {
5639
+ return takeLast (count , time , unit ).toList ();
5640
+ }
5641
+
5642
+ /**
5643
+ * Return an Observable which emits a single List containing at most count items
5644
+ * from this Observable which were emitted not before this completed minus a time window.
5645
+ * @param count the number of items to take last
5646
+ * @param time the length of the time window, relative to the completion of this
5647
+ * observable.
5648
+ * @param unit the time unit
5649
+ * @param scheduler the scheduler which provides the timestamps for the observed
5650
+ * elements
5651
+ * @return an Observable which emits a single List containing at most count items
5652
+ * from this Observable which were emitted not before this completed minus a time window.
5653
+ */
5654
+ public Observable <List <T >> takeLastBuffer (int count , long time , TimeUnit unit , Scheduler scheduler ) {
5655
+ return takeLast (count , time , unit , scheduler ).toList ();
5656
+ }
5657
+
5658
+
5492
5659
/**
5493
5660
* Returns an Observable that emits the items from the source Observable
5494
5661
* only until the <code>other</code> Observable emits an item.
0 commit comments