RX Java – with observable Just() and rxjava flatmap with one parameter

I'm using RX Java, and I have a question to understand flatmap

Observable.just(1)
                .flatMap(
                        item -> Observable.just(item + 1),e -> Observable.error(e),() -> Observable.never())
                .subscribe(
                        i -> {
                            Log.d(TAG,"Got " + i);
                        },e -> {
                            Log.d(TAG,"RxJava ERROR",e);
                        });

failed

java.lang.NullPointerException: Attempt to invoke virtual method 'void rx.internal.operators.OperatorMapNotification$SingleEmitter.offer(java.lang.Object)' on a null object reference
at rx.internal.operators.OperatorMapNotification$1.onNext(OperatorMapNotification.java:82)
at rx.internal.util.ScalarSynchronousObservable$1.call(ScalarSynchronousObservable.java:46)
at rx.internal.util.ScalarSynchronousObservable$1.call(ScalarSynchronousObservable.java:35)
at rx.Observable$1.call(Observable.java:145)
at rx.Observable$1.call(Observable.java:137)
at rx.Observable$1.call(Observable.java:145)
at rx.Observable$1.call(Observable.java:137)
at rx.Observable.subscribe(Observable.java:7803)
at rx.Observable.subscribe(Observable.java:7579)

Same code, but observable Just (1,2,3) works normally

Got 2
Got 3
Got 4

Is it an error or why does rxjava behave differently with only one parameter? Rxjava version is 1.0 thirteen

Solution

This is 1.0 13 and 1.0 14. Error of the The fix will be in 1.0 15 (not yet due)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>