我想改进observable的doOnNext块里面的睡眠。
如果有更好的方法,请推荐一下。
Observable.from(sampleList)
.buffer(5)
.doOnNext(first -> {
// first Logic
try {
Thread.sleep(500);
} catch (InterruptedException e) {}
})
.buffer(2)
.doOnNext(second -> {
// second Logic
try {
Thread.sleep(500);
} catch (InterruptedException e) {}
})
.buffer(2)
.doOnNext(third -> {
// third Logic
try {
Thread.sleep(500);
} catch (InterruptedException e) {}
})
.subscribe();