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

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

本文整理了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

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

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

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

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

  1. @Test
  2. public void test1() {
  3. Single<Boolean> single = Flowable.sequenceEqual(
  4. Flowable.just("one", "two", "three"),
  5. Flowable.just("one", "two", "three"));
  6. verifyResult(single, true);
  7. }

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

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

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

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

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

  1. @Test
  2. public void testWithEqualityError() {
  3. Single<Boolean> single = Flowable.sequenceEqual(
  4. Flowable.just("one"), Flowable.just("one"),
  5. new BiPredicate<String, String>() {
  6. @Override
  7. public boolean test(String t1, String t2) {
  8. throw new TestException();
  9. }
  10. });
  11. verifyError(single);
  12. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. @Test
  2. public void testWithError2() {
  3. Single<Boolean> single = Flowable.sequenceEqual(
  4. Flowable.just("one", "two", "three"),
  5. Flowable.concat(Flowable.just("one"),
  6. Flowable.<String> error(new TestException())));
  7. verifyError(single);
  8. }

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

  1. @Test
  2. public void testWithError1() {
  3. Single<Boolean> single = Flowable.sequenceEqual(
  4. Flowable.concat(Flowable.just("one"),
  5. Flowable.<String> error(new TestException())),
  6. Flowable.just("one", "two", "three"));
  7. verifyError(single);
  8. }

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

  1. @Test
  2. public void testWithError1Flowable() {
  3. Flowable<Boolean> flowable = Flowable.sequenceEqual(
  4. Flowable.concat(Flowable.just("one"),
  5. Flowable.<String> error(new TestException())),
  6. Flowable.just("one", "two", "three")).toFlowable();
  7. verifyError(flowable);
  8. }

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

  1. @Test
  2. public void testWithError2Flowable() {
  3. Flowable<Boolean> flowable = Flowable.sequenceEqual(
  4. Flowable.just("one", "two", "three"),
  5. Flowable.concat(Flowable.just("one"),
  6. Flowable.<String> error(new TestException()))).toFlowable();
  7. verifyError(flowable);
  8. }

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

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

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

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

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

  1. @Test
  2. public void testWithError3Flowable() {
  3. Flowable<Boolean> flowable = Flowable.sequenceEqual(
  4. Flowable.concat(Flowable.just("one"),
  5. Flowable.<String> error(new TestException())),
  6. Flowable.concat(Flowable.just("one"),
  7. Flowable.<String> error(new TestException()))).toFlowable();
  8. verifyError(flowable);
  9. }

相关文章

Flowable类方法