Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/390.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
RxJava:doOnNext和doOnEach之间的区别_Java_Rx Java - Fatal编程技术网

RxJava:doOnNext和doOnEach之间的区别

RxJava:doOnNext和doOnEach之间的区别,java,rx-java,Java,Rx Java,在哪些情况下我应该使用doOnNext,在哪些情况下 杜尼奇 .doOnEach(new Action1<Notification<? super MessageProfile>>() { @Override public void call(Notification<? super MessageProfile> notification) { }

在哪些情况下我应该使用doOnNext,在哪些情况下 杜尼奇

 .doOnEach(new Action1<Notification<? super MessageProfile>>() {
                @Override
                public void call(Notification<? super MessageProfile> notification) {

                }
            })
 .doOnNext(new Action1<MessageProfile>() {
                @Override
                public void call(MessageProfile profile) {
                    messageProfileDao.save(profile);
                }
            })

.doOnEach(新行动1他们确实非常接近。
有一点不同(实际上,在javadoc中可能不太清楚,在sourcecode中更为明显),那就是在doOnEach中,您还可以获得错误和完成事件的
通知

然后,您可以检查
isOnNext
isOnCompleted
isOnError
,以检查收到通知的事件的实际类型

因此,一个
行动。调用
来统治所有人,而不是一个成熟的
观察者