io.reactivex.Flowable.sequenceEqual()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中io.reactivex.Flowable.sequenceEqual()方法的一些代码示例,展示了Flowable.sequenceEqual()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flowable.sequenceEqual()方法的具体详情如下:
包路径:io.reactivex.Flowable
类名称:Flowable
方法名:sequenceEqual

Flowable.sequenceEqual介绍

[英]Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the same by comparing the items emitted by each Publisher pairwise.

Backpressure: This operator honors downstream backpressure and expects both of its sources to honor backpressure as well. If violated, the operator will emit a MissingBackpressureException. Scheduler: sequenceEqual does not operate by default on a particular Scheduler.
[中]返回发出布尔值的单个值,该值通过比较每个发布者成对发出的项来指示两个发布者序列是否相同。
背压:该操作员尊重下游背压,并期望其两个来源也尊重背压。如果违反,操作员将发出MissingBackpressureException。Scheduler:sequenceEqual默认情况下不在特定计划程序上运行。

代码示例

代码示例来源:origin: ReactiveX/RxJava

@Test
public void test3() {
  Single<Boolean> single = Flowable.sequenceEqual(
      Flowable.just("one", "two", "three", "four"),
      Flowable.just("one", "two", "three"));
  verifyResult(single, false);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testWithEmpty3() {
  Single<Boolean> single = Flowable.sequenceEqual(
      Flowable.<String> empty(), Flowable.<String> empty());
  verifyResult(single, true);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void test1() {
  Single<Boolean> single = Flowable.sequenceEqual(
      Flowable.just("one", "two", "three"),
      Flowable.just("one", "two", "three"));
  verifyResult(single, true);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testWithEmpty1() {
  Single<Boolean> single = Flowable.sequenceEqual(
      Flowable.<String> empty(),
      Flowable.just("one", "two", "three"));
  verifyResult(single, false);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testWithEmpty2() {
  Single<Boolean> single = Flowable.sequenceEqual(
      Flowable.just("one", "two", "three"),
      Flowable.<String> empty());
  verifyResult(single, false);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testWithEqualityError() {
  Single<Boolean> single = Flowable.sequenceEqual(
      Flowable.just("one"), Flowable.just("one"),
      new BiPredicate<String, String>() {
        @Override
        public boolean test(String t1, String t2) {
          throw new TestException();
        }
      });
  verifyError(single);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void test2Flowable() {
  Flowable<Boolean> flowable = Flowable.sequenceEqual(
      Flowable.just("one", "two", "three"),
      Flowable.just("one", "two", "three", "four")).toFlowable();
  verifyResult(flowable, false);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testWithEmpty1Flowable() {
  Flowable<Boolean> flowable = Flowable.sequenceEqual(
      Flowable.<String> empty(),
      Flowable.just("one", "two", "three")).toFlowable();
  verifyResult(flowable, false);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
@Ignore("Null values not allowed")
public void testWithNull2() {
  Single<Boolean> single = Flowable.sequenceEqual(
      Flowable.just((String) null), Flowable.just((String) null));
  verifyResult(single, true);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void test3Flowable() {
  Flowable<Boolean> flowable = Flowable.sequenceEqual(
      Flowable.just("one", "two", "three", "four"),
      Flowable.just("one", "two", "three")).toFlowable();
  verifyResult(flowable, false);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testWithEmpty3Flowable() {
  Flowable<Boolean> flowable = Flowable.sequenceEqual(
      Flowable.<String> empty(), Flowable.<String> empty()).toFlowable();
  verifyResult(flowable, true);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
@Ignore("Null values not allowed")
public void testWithNull2Flowable() {
  Flowable<Boolean> flowable = Flowable.sequenceEqual(
      Flowable.just((String) null), Flowable.just((String) null)).toFlowable();
  verifyResult(flowable, true);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void simpleInequalObservable() {
  Flowable.sequenceEqual(Flowable.just(1), Flowable.just(2))
  .toFlowable()
  .test()
  .assertResult(false);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testWithError2() {
  Single<Boolean> single = Flowable.sequenceEqual(
      Flowable.just("one", "two", "three"),
      Flowable.concat(Flowable.just("one"),
          Flowable.<String> error(new TestException())));
  verifyError(single);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testWithError1() {
  Single<Boolean> single = Flowable.sequenceEqual(
      Flowable.concat(Flowable.just("one"),
          Flowable.<String> error(new TestException())),
      Flowable.just("one", "two", "three"));
  verifyError(single);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testWithError1Flowable() {
  Flowable<Boolean> flowable = Flowable.sequenceEqual(
      Flowable.concat(Flowable.just("one"),
          Flowable.<String> error(new TestException())),
      Flowable.just("one", "two", "three")).toFlowable();
  verifyError(flowable);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testWithError2Flowable() {
  Flowable<Boolean> flowable = Flowable.sequenceEqual(
      Flowable.just("one", "two", "three"),
      Flowable.concat(Flowable.just("one"),
          Flowable.<String> error(new TestException()))).toFlowable();
  verifyError(flowable);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void longSequenceEquals() {
  Flowable<Integer> source = Flowable.range(1, Flowable.bufferSize() * 4).subscribeOn(Schedulers.computation());
  Flowable.sequenceEqual(source, source)
  .test()
  .awaitDone(5, TimeUnit.SECONDS)
  .assertResult(true);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void longSequenceEqualsFlowable() {
  Flowable<Integer> source = Flowable.range(1, Flowable.bufferSize() * 4).subscribeOn(Schedulers.computation());
  Flowable.sequenceEqual(source, source)
  .toFlowable()
  .test()
  .awaitDone(5, TimeUnit.SECONDS)
  .assertResult(true);
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testWithError3Flowable() {
  Flowable<Boolean> flowable = Flowable.sequenceEqual(
      Flowable.concat(Flowable.just("one"),
          Flowable.<String> error(new TestException())),
      Flowable.concat(Flowable.just("one"),
          Flowable.<String> error(new TestException()))).toFlowable();
  verifyError(flowable);
}

相关文章

Flowable类方法