@@ -2746,6 +2746,38 @@ trait Observable[+T]
2746
2746
toScalaObservable[util.Map [K , V ]](o).map(m => mapFactory() ++ m.toMap)
2747
2747
}
2748
2748
2749
+ /**
2750
+ * Returns an Observable that emits a Boolean value that indicates whether `this` and `that` Observable sequences are the
2751
+ * same by comparing the items emitted by each Observable pairwise.
2752
+ * <p>
2753
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/sequenceEqual.png">
2754
+ *
2755
+ * Note: this method uses `==` to compare elements. It's a bit different from RxJava which uses `Object.equals`.
2756
+ *
2757
+ * @param that the Observable to compare
2758
+ * @return an Observable that emits a `Boolean` value that indicates whether the two sequences are the same
2759
+ */
2760
+ def sequenceEqual [U >: T ](that : Observable [U ]): Observable [Boolean ] = {
2761
+ sequenceEqual(that, (_1 : U , _2 : U ) => _1 == _2)
2762
+ }
2763
+
2764
+ /**
2765
+ * Returns an Observable that emits a Boolean value that indicates whether `this` and `that` Observable sequences are the
2766
+ * same by comparing the items emitted by each Observable pairwise based on the results of a specified `equality` function.
2767
+ * <p>
2768
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/sequenceEqual.png">
2769
+ *
2770
+ * @param that the Observable to compare
2771
+ * @param equality a function used to compare items emitted by each Observable
2772
+ * @return an Observable that emits a `Boolean` value that indicates whether the two sequences are the same based on the `equality` function.
2773
+ */
2774
+ def sequenceEqual [U >: T ](that : Observable [U ], equality : (U , U ) => Boolean ): Observable [Boolean ] = {
2775
+ val thisJava : rx.Observable [_ <: U ] = this .asJavaObservable
2776
+ val thatJava : rx.Observable [_ <: U ] = that.asJavaObservable
2777
+ val equalityJava : Func2 [_ >: U , _ >: U , java.lang.Boolean ] = equality
2778
+ toScalaObservable[java.lang.Boolean ](rx.Observable .sequenceEqual[U ](thisJava, thatJava, equalityJava)).map(_.booleanValue)
2779
+ }
2780
+
2749
2781
/**
2750
2782
* Lift a function to the current Observable and return a new Observable that when subscribed to will pass
2751
2783
* the values of the current Observable through the function.
0 commit comments