RxJava delay for each item of list emitted
The simplest way to do this seems to be just using concatMap and wrapping each item in a delayed Obserable. long startTime = System.currentTimeMillis(); Observable.range(1, 5) .concatMap(i-> Observable.just(i).delay(50, TimeUnit.MILLISECONDS)) .doOnNext(i-> System.out.println( “Item: ” + i + “, Time: ” + (System.currentTimeMillis() – startTime) +”ms”)) .toCompletable().await(); Prints: Item: 1, Time: 51ms Item: 2, Time: 101ms Item: … Read more