RxJava2.x-range语法

一、range语法

    public void rxJavaRangeExample() {
        Disposable disposable = Observable.range(-1, 10)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer() {
                    @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发送个数

你可能感兴趣的:(RxJava2.x-range语法)