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

x33g5p2x  于2022-01-25 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(130)

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

Observable.sequenceEqual介绍

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

Scheduler: sequenceEqual does not operate by default on a particular Scheduler.
[中]返回一个单一值,该值发出一个布尔值,通过比较每个ObservableSource成对发出的项来指示两个ObservableSource序列是否相同。
Scheduler:sequenceEqual默认情况下不会在特定的计划程序上运行。

代码示例

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

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

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

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

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

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

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

@Test
public void simpleInequal() {
  Observable.sequenceEqual(Observable.just(1), Observable.just(2))
  .test()
  .assertResult(false);
}

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

@Test
public void test2Observable() {
  Observable<Boolean> o = Observable.sequenceEqual(
      Observable.just("one", "two", "three"),
      Observable.just("one", "two", "three", "four")).toObservable();
  verifyResult(o, false);
}

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

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

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

@Test
@Ignore("Null values not allowed")
public void testWithNull1() {
  Single<Boolean> o = Observable.sequenceEqual(
      Observable.just((String) null), Observable.just("one"));
  verifyResult(o, false);
}

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

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

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

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

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

@Test
@Ignore("Null values not allowed")
public void testWithNull2Observable() {
  Observable<Boolean> o = Observable.sequenceEqual(
      Observable.just((String) null), Observable.just((String) null)).toObservable();
  verifyResult(o, true);
}

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

@Test
public void testWithEmpty2Observable() {
  Observable<Boolean> o = Observable.sequenceEqual(
      Observable.just("one", "two", "three"),
      Observable.<String> empty()).toObservable();
  verifyResult(o, false);
}

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

@Test
public void testWithEmpty1Observable() {
  Observable<Boolean> o = Observable.sequenceEqual(
      Observable.<String> empty(),
      Observable.just("one", "two", "three")).toObservable();
  verifyResult(o, false);
}

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

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

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

@Test
public void testWithError1Observable() {
  Observable<Boolean> o = Observable.sequenceEqual(
      Observable.concat(Observable.just("one"),
          Observable.<String> error(new TestException())),
      Observable.just("one", "two", "three")).toObservable();
  verifyError(o);
}

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

@Test
public void testWithError2Observable() {
  Observable<Boolean> o = Observable.sequenceEqual(
      Observable.just("one", "two", "three"),
      Observable.concat(Observable.just("one"),
          Observable.<String> error(new TestException()))).toObservable();
  verifyError(o);
}

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

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

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

@Test
public void testWithError3() {
  Single<Boolean> o = Observable.sequenceEqual(
      Observable.concat(Observable.just("one"),
          Observable.<String> error(new TestException())),
      Observable.concat(Observable.just("one"),
          Observable.<String> error(new TestException())));
  verifyError(o);
}

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

@Test
public void testWithEmpty3Observable() {
  Observable<Boolean> o = Observable.sequenceEqual(
      Observable.<String> empty(), Observable.<String> empty()).toObservable();
  verifyResult(o, true);
}

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

@Test
public void testWithError3Observable() {
  Observable<Boolean> o = Observable.sequenceEqual(
      Observable.concat(Observable.just("one"),
          Observable.<String> error(new TestException())),
      Observable.concat(Observable.just("one"),
          Observable.<String> error(new TestException()))).toObservable();
  verifyError(o);
}

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

@Test
public void prefetchObservable() {
  Observable.sequenceEqual(Observable.range(1, 20), Observable.range(1, 20), 2)
  .toObservable()
  .test()
  .assertResult(true);
}

相关文章

Observable类方法