Java Code Examples for io.reactivex.Flowable#interval()
The following examples show how to use
io.reactivex.Flowable#interval() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NoWebMain.java From akarnokd-misc with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws IOException, InterruptedException { Flowable<Long> flowA = Flowable.interval(100, TimeUnit.MILLISECONDS); Flowable<Long> flowB = Flowable.interval(200, TimeUnit.MILLISECONDS); Flowable<LongCouple> combined = Flowable.combineLatest(Arrays.asList(flowA.onBackpressureLatest(), flowB.onBackpressureLatest()), a -> new LongCouple((Long) a[0], (Long) a[1]), 1) .onBackpressureLatest() .observeOn(Schedulers.newThread(), false, 1); combined.subscribe((longCouple -> { System.out.println(longCouple.aLong + ":" + longCouple.bLong); Thread.sleep(1000); })); Thread.sleep(10000000); }
Example 2
Source File: PlaybackModule.java From klingar with Apache License 2.0 | 4 votes |
@Provides Flowable<Long> provideSeconds() { return Flowable.interval(1, TimeUnit.SECONDS); }