RxJava2 Flowable ambWith

目录

ambWith

ambWith图解

ambWith测试用例

ambWith分析

ambWith实用场景

镜像


ambWith

Flowable<T>

ambWith(Publisher<? extends T> other)

镜像首先发射项目或终止通知的Publisher

ambWith图解

5163a9c55e7ee44f8f799561250cbaee7d9.jpg

ambWith测试用例

测试代码
 private void ambWith() {

        Flowable flowable = Flowable.just("instance");
        System.out.println("原始Publisher的hashCode" +flowable.hashCode());
        Flowable mirroring = flowable.ambWith(flowable);
        System.out.println("镜像Publisher的hashCode" +mirroring.hashCode());
    }

测试结果:
10-03 00:17:21.688 2747-2747/hq.demo.net I/System.out: 原始Publisher的hashCode59760856
10-03 00:17:21.688 2747-2747/hq.demo.net I/System.out: 镜像Publisher的hashCode164936753

ambWith分析

ambWith其实就是根据给定Publisher做出一个镜像

ambWith实用场景

(后续完善)

镜像

镜像(Mirroring)是冗余的一种类型,一个磁盘上的数据在另一个磁盘上存在一个完全相同的副本即为镜像。

镜像是一种文件存储形式,可以把许多文件做成一个镜像文件,与GHOST等程序放在一个盘里用GHOST等软件打开后,又恢复成许多文件,RAID 1和RAID 10使用的就是镜像。常见的镜像文件格式有ISO、BIN、IMG、TAO、DAO、CIF、FCD。

猜你喜欢

转载自blog.csdn.net/weixin_36709064/article/details/82936469