OperatorSequenceEqual { public static <T> Observable<Boolean> sequenceEqual( Observable<? extends T> first, Observable<? extends T> second, final Func2<? super T, ? super T, Boolean> equality) { Observable<Object> firstObservable = materializeLite(first); Observable<Object> secondObservable = materializeLite(second); return zip(firstObservable, secondObservable, new Func2<Object, Object, Boolean>() { @Override @SuppressWarnings("unchecked") public Boolean call(Object t1, Object t2) { boolean c1 = t1 == LOCAL_ONCOMPLETED; boolean c2 = t2 == LOCAL_ONCOMPLETED; if (c1 && c2) { return true; } if (c1 || c2) { return false; } return equality.call((T)t1, (T)t2); } }).all(UtilityFunctions.<Boolean> identity()); } private  OperatorSequenceEqual(); static Observable<Boolean> sequenceEqual(
            Observable<? extends T> first, Observable<? extends T> second,
            final Func2<? super T, ? super T, Boolean> equality);  }
@Test public void test1() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.just("one", "two", "three"), Observable.just("one", "two", "three")); verifyResult(observable, true); }
@Test public void test2() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.just("one", "two", "three"), Observable.just("one", "two", "three", "four")); verifyResult(observable, false); }
@Test public void test3() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.just("one", "two", "three", "four"), Observable.just("one", "two", "three")); verifyResult(observable, false); }
@Test public void testWithError1() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.concat(Observable.just("one"), Observable.<String> error(new TestException())), Observable.just("one", "two", "three")); verifyError(observable); }
@Test public void testWithError2() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.just("one", "two", "three"), Observable.concat(Observable.just("one"), Observable.<String> error(new TestException()))); verifyError(observable); }
@Test public void testWithError3() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.concat(Observable.just("one"), Observable.<String> error(new TestException())), Observable.concat(Observable.just("one"), Observable.<String> error(new TestException()))); verifyError(observable); }
@Test public void testWithEmpty1() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.<String> empty(), Observable.just("one", "two", "three")); verifyResult(observable, false); }
@Test public void testWithEmpty2() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.just("one", "two", "three"), Observable.<String> empty()); verifyResult(observable, false); }
@Test public void testWithEmpty3() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.<String> empty(), Observable.<String> empty()); verifyResult(observable, true); }
@Test public void testWithNull1() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.just((String) null), Observable.just("one")); verifyResult(observable, false); }
@Test public void testWithNull2() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.just((String) null), Observable.just((String) null)); verifyResult(observable, true); }
@Test public void testWithEqualityError() { Observable<Boolean> observable = Observable.sequenceEqual( Observable.just("one"), Observable.just("one"), new Func2<String, String, Boolean>() { @Override public Boolean call(String t1, String t2) { throw new TestException(); } }); verifyError(observable); }