@@ -89,6 +89,9 @@ class CompletenessTest extends JUnitSuite {
89
89
" groupBy(Func1[_ >: T, _ <: K], Func1[_ >: T, _ <: R])" -> " [use `groupBy` and `map`]" ,
90
90
" groupByUntil(Func1[_ >: T, _ <: TKey], Func1[_ >: GroupedObservable[TKey, T], _ <: Observable[_ <: TDuration]])" -> " groupByUntil(T => K, (K, Observable[T]) => Observable[Any])" ,
91
91
" ignoreElements()" -> " [use `filter(_ => false)`]" ,
92
+ " last(Func1[_ >: T, Boolean])" -> " [use `filter(predicate).last`]" ,
93
+ " lastOrDefault(T)" -> " lastOrElse(=> U)" ,
94
+ " lastOrDefault(T, Func1[_ >: T, Boolean])" -> " [use `filter(predicate).lastOrElse(default)`]" ,
92
95
" lift(Operator[_ <: R, _ >: T])" -> " lift(Subscriber[R] => Subscriber[T])" ,
93
96
" limit(Int)" -> " take(Int)" ,
94
97
" mapWithIndex(Func2[_ >: T, Integer, _ <: R])" -> " [combine `zipWithIndex` with `map` or with a for comprehension]" ,
@@ -117,13 +120,15 @@ class CompletenessTest extends JUnitSuite {
117
120
" sample(Observable[U])" -> " sample(Observable[Any])" ,
118
121
" scan(Func2[T, T, T])" -> unnecessary,
119
122
" scan(R, Func2[R, _ >: T, R])" -> " scan(R)((R, T) => R)" ,
123
+ " single(Func1[_ >: T, Boolean])" -> " [use `filter(predicate).single`]" ,
124
+ " singleOrDefault(T)" -> " singleOrElse(=> U)" ,
125
+ " singleOrDefault(T, Func1[_ >: T, Boolean])" -> " [use `filter(predicate).singleOrElse(default)`]" ,
120
126
" skip(Int)" -> " drop(Int)" ,
121
127
" skip(Long, TimeUnit)" -> " drop(Duration)" ,
122
128
" skip(Long, TimeUnit, Scheduler)" -> " drop(Duration, Scheduler)" ,
123
129
" skipWhile(Func1[_ >: T, Boolean])" -> " dropWhile(T => Boolean)" ,
124
130
" skipWhileWithIndex(Func2[_ >: T, Integer, Boolean])" -> unnecessary,
125
131
" skipUntil(Observable[U])" -> " dropUntil(Observable[E])" ,
126
- " single(Func1[_ >: T, Boolean])" -> " [use `filter(predicate).single`]" ,
127
132
" startWith(T)" -> " [use `item +: o`]" ,
128
133
" startWith(Array[T])" -> " [use `Observable.items(items) ++ o`]" ,
129
134
" startWith(Array[T], Scheduler)" -> " [use `Observable.items(items).subscribeOn(scheduler) ++ o`]" ,
@@ -159,8 +164,6 @@ class CompletenessTest extends JUnitSuite {
159
164
" window(Observable[_ <: TOpening], Func1[_ >: TOpening, _ <: Observable[_ <: TClosing]])" -> " window(Observable[Opening], Opening => Observable[Any])" ,
160
165
" window(Long, Long, TimeUnit)" -> " window(Duration, Duration)" ,
161
166
" window(Long, Long, TimeUnit, Scheduler)" -> " window(Duration, Duration, Scheduler)" ,
162
- " zip(Observable[_ <: T2], Func2[_ >: T, _ >: T2, _ <: R])" -> " zipWith(Observable[U], (T, U) => R)" ,
163
- " zip(Iterable[_ <: T2], Func2[_ >: T, _ >: T2, _ <: R])" -> " zipWith(Iterable[U], (T, U) => R)" ,
164
167
165
168
// manually added entries for Java static methods
166
169
" average(Observable[Integer])" -> averageProblem,
@@ -197,7 +200,9 @@ class CompletenessTest extends JUnitSuite {
197
200
" switchOnNext(Observable[_ <: Observable[_ <: T]])" -> " switch(<:<[Observable[T], Observable[Observable[U]]])" ,
198
201
" zip(Observable[_ <: T1], Observable[_ <: T2], Func2[_ >: T1, _ >: T2, _ <: R])" -> " [use instance method `zip` and `map`]" ,
199
202
" zip(Observable[_ <: Observable[_]], FuncN[_ <: R])" -> " [use `zip` in companion object and `map`]" ,
200
- " zip(Iterable[_ <: Observable[_]], FuncN[_ <: R])" -> " [use `zip` in companion object and `map`]"
203
+ " zip(Iterable[_ <: Observable[_]], FuncN[_ <: R])" -> " [use `zip` in companion object and `map`]" ,
204
+ " zip(Observable[_ <: T2], Func2[_ >: T, _ >: T2, _ <: R])" -> " zipWith(Observable[U], (T, U) => R)" ,
205
+ " zip(Iterable[_ <: T2], Func2[_ >: T, _ >: T2, _ <: R])" -> " zipWith(Iterable[U], (T, U) => R)"
201
206
) ++ List .iterate(" T, T" , 8 )(s => s + " , T" ).map(
202
207
// all 9 overloads of startWith:
203
208
" startWith(" + _ + " )" -> " [use `Observable.items(...) ++ o`]"
@@ -345,6 +350,7 @@ class CompletenessTest extends JUnitSuite {
345
350
println( " ----------------------------------------------\n " )
346
351
347
352
val actualMethods = getPublicInstanceAndCompanionMethods(typeOf[rx.lang.scala.Observable [_]]).toSet
353
+ actualMethods.toList.sorted.foreach(println)
348
354
var good = 0
349
355
var bad = 0
350
356
for ((javaM, scalaM) <- SortedMap (correspondence.toSeq :_* )) {
0 commit comments