|
19 | 19 | import java.util.Arrays;
|
20 | 20 | import java.util.Collection;
|
21 | 21 | import java.util.List;
|
| 22 | +import java.util.concurrent.Executors; |
22 | 23 | import java.util.concurrent.Future;
|
23 | 24 | import java.util.concurrent.TimeUnit;
|
24 | 25 |
|
|
36 | 37 | import rx.operators.OperationFilter;
|
37 | 38 | import rx.operators.OperationFinally;
|
38 | 39 | import rx.operators.OperationGroupBy;
|
| 40 | +import rx.operators.OperationInterval; |
39 | 41 | import rx.operators.OperationMap;
|
40 | 42 | import rx.operators.OperationMaterialize;
|
41 | 43 | import rx.operators.OperationMerge;
|
|
65 | 67 | import rx.operators.OperationZip;
|
66 | 68 | import rx.operators.SafeObservableSubscription;
|
67 | 69 | import rx.operators.SafeObserver;
|
| 70 | +import rx.operators.OperationInterval.Interval; |
68 | 71 | import rx.plugins.RxJavaErrorHandler;
|
69 | 72 | import rx.plugins.RxJavaObservableExecutionHook;
|
70 | 73 | import rx.plugins.RxJavaPlugins;
|
@@ -827,6 +830,35 @@ public static <T> Observable<T> synchronize(Observable<? extends T> observable)
|
827 | 830 | return create(OperationSynchronize.synchronize(observable));
|
828 | 831 | }
|
829 | 832 |
|
| 833 | + |
| 834 | + /** |
| 835 | + * Emits an item each time interval (containing a sequential number). |
| 836 | + * @param interval |
| 837 | + * Interval size in time units (see below). |
| 838 | + * @param unit |
| 839 | + * Time units to use for the interval size. |
| 840 | + * @return An Observable that emits an item each time interval. |
| 841 | + * @see <a href="http://msdn.microsoft.com/en-us/library/hh229027%28v=vs.103%29.aspx">MSDN: Observable.Interval</a> |
| 842 | + */ |
| 843 | + public static Observable<Long> interval(long interval, TimeUnit unit) { |
| 844 | + return create(OperationInterval.interval(interval, unit)); |
| 845 | + } |
| 846 | + |
| 847 | + /** |
| 848 | + * Emits an item each time interval (containing a sequential number). |
| 849 | + * @param interval |
| 850 | + * Interval size in time units (see below). |
| 851 | + * @param unit |
| 852 | + * Time units to use for the interval size. |
| 853 | + * @param scheduler |
| 854 | + * The scheduler to use for scheduling the items. |
| 855 | + * @return An Observable that emits an item each time interval. |
| 856 | + * @see <a href="http://msdn.microsoft.com/en-us/library/hh228911%28v=vs.103%29.aspx">MSDN: Observable.Interval</a> |
| 857 | + */ |
| 858 | + public static Observable<Long> interval(long interval, TimeUnit unit, Scheduler scheduler) { |
| 859 | + return create(OperationInterval.interval(interval, unit, scheduler)); |
| 860 | + } |
| 861 | + |
830 | 862 | /**
|
831 | 863 | * Wraps each item emitted by a source Observable in a {@link Timestamped} object.
|
832 | 864 | * <p>
|
|
0 commit comments