一、range语法
public void rxJavaRangeExample() {
Disposable disposable = Observable.range(-1, 10)
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Integer>() {
@Override
public void accept(Integer integer) throws Exception {
LogUtils.error(TAG, "rxJavaRangeExample--:" + Thread.currentThread().getName() + "-consumer-:" + integer);
}
});
compositeDisposable.add(disposable);
}
日志
08-22 11:05:51.445 24869-24869/com.example.zhang E/MainPresenter: rxJavaRangeExample--:main-consumer-:-1
rxJavaRangeExample--:main-consumer-:0
rxJavaRangeExample--:main-consumer-:1
08-22 11:05:51.446 24869-24869/com.example.zhang E/MainPresenter: rxJavaRangeExample--:main-consumer-:2
rxJavaRangeExample--:main-consumer-:3
rxJavaRangeExample--:main-consumer-:4
rxJavaRangeExample--:main-consumer-:5
rxJavaRangeExample--:main-consumer-:6
rxJavaRangeExample--:main-consumer-:7
rxJavaRangeExample--:main-consumer-:8
总结
1、range(final int start, final int count) start 初始值,count发送个数
河马过河微信公众号.jpg
网友评论