@@ -76,19 +76,18 @@ class CompletenessTest extends JUnitSuite {
76
76
" buffer(Observable[B])" -> " buffer(Observable[Any])" ,
77
77
" buffer(Observable[B], Int)" -> " buffer(Observable[Any], Int)" ,
78
78
" buffer(Observable[_ <: TOpening], Func1[_ >: TOpening, _ <: Observable[_ <: TClosing]])" -> " buffer(Observable[Opening], Opening => Observable[Any])" ,
79
- " contains(T )" -> " contains(Any )" ,
79
+ " contains(Any )" -> " contains(U )" ,
80
80
" count()" -> " length" ,
81
81
" delay(Func0[_ <: Observable[U]], Func1[_ >: T, _ <: Observable[V]])" -> " delay(() => Observable[Any], T => Observable[Any])" ,
82
82
" delay(Func1[_ >: T, _ <: Observable[U]])" -> " delay(T => Observable[Any])" ,
83
83
" dematerialize()" -> " dematerialize(<:<[Observable[T], Observable[Notification[U]]])" ,
84
- " elementAt(Int)" -> " [use `.drop(index).first`]" ,
85
- " elementAtOrDefault(Int, T)" -> " [use `.drop(index).firstOrElse(default)`]" ,
84
+ " elementAtOrDefault(Int, T)" -> " elementAtOrDefault(Int, U)" ,
86
85
" first(Func1[_ >: T, Boolean])" -> commentForFirstWithPredicate,
87
86
" firstOrDefault(T)" -> " firstOrElse(=> U)" ,
88
- " firstOrDefault(Func1[_ >: T, Boolean], T )" -> " [use `.filter(condition).firstOrElse(default)`]" ,
87
+ " firstOrDefault(T, Func1[_ >: T, Boolean])" -> " [use `.filter(condition).firstOrElse(default)`]" ,
89
88
" groupBy(Func1[_ >: T, _ <: K], Func1[_ >: T, _ <: R])" -> " [use `groupBy` and `map`]" ,
89
+ " groupByUntil(Func1[_ >: T, _ <: TKey], Func1[_ >: GroupedObservable[TKey, T], _ <: Observable[_ <: TDuration]])" -> " groupByUntil(T => K, (K, Observable[T]) => Observable[Any])" ,
90
90
" lift(Operator[_ <: R, _ >: T])" -> " lift(Subscriber[R] => Subscriber[T])" ,
91
- " mapMany(Func1[_ >: T, _ <: Observable[_ <: R]])" -> " flatMap(T => Observable[R])" ,
92
91
" mapWithIndex(Func2[_ >: T, Integer, _ <: R])" -> " [combine `zipWithIndex` with `map` or with a for comprehension]" ,
93
92
" onErrorResumeNext(Func1[Throwable, _ <: Observable[_ <: T]])" -> " onErrorResumeNext(Throwable => Observable[U])" ,
94
93
" onErrorResumeNext(Observable[_ <: T])" -> " onErrorResumeNext(Observable[U])" ,
@@ -102,6 +101,7 @@ class CompletenessTest extends JUnitSuite {
102
101
" publish(Func1[_ >: Observable[T], _ <: Observable[R]], T)" -> " publish(Observable[U] => Observable[R], U)" ,
103
102
" reduce(Func2[T, T, T])" -> " reduce((U, U) => U)" ,
104
103
" reduce(R, Func2[R, _ >: T, R])" -> " foldLeft(R)((R, T) => R)" ,
104
+ " repeat()" -> " repeat()" ,
105
105
" retry()" -> " retry()" ,
106
106
" scan(Func2[T, T, T])" -> unnecessary,
107
107
" scan(R, Func2[R, _ >: T, R])" -> " scan(R)((R, T) => R)" ,
@@ -120,8 +120,8 @@ class CompletenessTest extends JUnitSuite {
120
120
" skipLast(Int)" -> " dropRight(Int)" ,
121
121
" skipLast(Long, TimeUnit)" -> " dropRight(Duration)" ,
122
122
" skipLast(Long, TimeUnit, Scheduler)" -> " dropRight(Duration, Scheduler)" ,
123
- " takeFirst ()" -> " first " ,
124
- " takeFirst(Func1[_ >: T, Boolean])" -> commentForFirstWithPredicate ,
123
+ " subscribe ()" -> " subscribe() " ,
124
+ " takeFirst(Func1[_ >: T, Boolean])" -> " [use `filter(condition).take(1)`] " ,
125
125
" takeLast(Int)" -> " takeRight(Int)" ,
126
126
" takeLast(Long, TimeUnit)" -> " takeRight(Duration)" ,
127
127
" takeLast(Long, TimeUnit, Scheduler)" -> " takeRight(Duration, Scheduler)" ,
@@ -142,7 +142,6 @@ class CompletenessTest extends JUnitSuite {
142
142
" toList()" -> " toSeq" ,
143
143
" toSortedList()" -> " [Sorting is already done in Scala's collection library, use `.toSeq.map(_.sorted)`]" ,
144
144
" toSortedList(Func2[_ >: T, _ >: T, Integer])" -> " [Sorting is already done in Scala's collection library, use `.toSeq.map(_.sortWith(f))`]" ,
145
- " where(Func1[_ >: T, Boolean])" -> " filter(T => Boolean)" ,
146
145
" window(Long, Long, TimeUnit)" -> " window(Duration, Duration)" ,
147
146
" window(Long, Long, TimeUnit, Scheduler)" -> " window(Duration, Duration, Scheduler)" ,
148
147
@@ -151,32 +150,30 @@ class CompletenessTest extends JUnitSuite {
151
150
" averageDoubles(Observable[Double])" -> averageProblem,
152
151
" averageFloats(Observable[Float])" -> averageProblem,
153
152
" averageLongs(Observable[Long])" -> averageProblem,
154
- " create(OnSubscribeFunc[T])" -> " apply(Observer[T] => Subscription)" ,
153
+ " create(OnSubscribeFunc[T])" -> " create(Observer[T] => Subscription)" ,
154
+ " create(OnSubscribe[T])" -> " apply(Subscriber[T] => Unit)" ,
155
155
" combineLatest(Observable[_ <: T1], Observable[_ <: T2], Func2[_ >: T1, _ >: T2, _ <: R])" -> " combineLatest(Observable[U])" ,
156
156
" concat(Observable[_ <: Observable[_ <: T]])" -> " concat(<:<[Observable[T], Observable[Observable[U]]])" ,
157
157
" defer(Func0[_ <: Observable[_ <: T]])" -> " defer(=> Observable[T])" ,
158
- " empty()" -> " apply(T*)" ,
159
- " error(Throwable)" -> " apply(Throwable)" ,
160
- " from(Array[T])" -> " apply(T*)" ,
161
- " from(Iterable[_ <: T])" -> " apply(T*)" ,
158
+ " from(Array[T])" -> " [use `items(T*)`]" ,
159
+ " from(Iterable[_ <: T])" -> " from(Iterable[T])" ,
162
160
" from(Future[_ <: T])" -> fromFuture,
163
161
" from(Future[_ <: T], Long, TimeUnit)" -> fromFuture,
164
162
" from(Future[_ <: T], Scheduler)" -> fromFuture,
165
- " just(T)" -> " apply(T*)" ,
163
+ " just(T)" -> " [use `items(T*)`]" ,
164
+ " just(T, Scheduler)" -> " [use `items(T*).subscribeOn(scheduler)`]" ,
166
165
" merge(Observable[_ <: T], Observable[_ <: T])" -> " merge(Observable[U])" ,
167
166
" merge(Observable[_ <: Observable[_ <: T]])" -> " flatten(<:<[Observable[T], Observable[Observable[U]]])" ,
168
167
" mergeDelayError(Observable[_ <: T], Observable[_ <: T])" -> " mergeDelayError(Observable[U])" ,
169
168
" mergeDelayError(Observable[_ <: Observable[_ <: T]])" -> " flattenDelayError(<:<[Observable[T], Observable[Observable[U]]])" ,
170
- " range(Int, Int)" -> " apply(Range)" ,
171
- " repeat()" -> " repeat()" ,
172
- " retry()" -> " retry()" ,
173
169
" sequenceEqual(Observable[_ <: T], Observable[_ <: T])" -> " sequenceEqual(Observable[U])" ,
174
170
" sequenceEqual(Observable[_ <: T], Observable[_ <: T], Func2[_ >: T, _ >: T, Boolean])" -> " sequenceEqual(Observable[U], (U, U) => Boolean)" ,
171
+ " range(Int, Int)" -> " [use `(start until (start + count)).toObservable` instead of `range(start, count)`]" ,
172
+ " range(Int, Int, Scheduler)" -> " [use `(start until (start + count)).toObservable.subscribeOn(scheduler)` instead of `range(start, count, scheduler)`]`]" ,
175
173
" sum(Observable[Integer])" -> " sum(Numeric[U])" ,
176
174
" sumDoubles(Observable[Double])" -> " sum(Numeric[U])" ,
177
175
" sumFloats(Observable[Float])" -> " sum(Numeric[U])" ,
178
176
" sumLongs(Observable[Long])" -> " sum(Numeric[U])" ,
179
- " synchronize(Observable[T])" -> " synchronize" ,
180
177
" switchDo(Observable[_ <: Observable[_ <: T]])" -> deprecated,
181
178
" switchOnNext(Observable[_ <: Observable[_ <: T]])" -> " switch(<:<[Observable[T], Observable[Observable[U]]])" ,
182
179
" zip(Observable[_ <: T1], Observable[_ <: T2], Func2[_ >: T1, _ >: T2, _ <: R])" -> " [use instance method `zip` and `map`]" ,
@@ -190,7 +187,7 @@ class CompletenessTest extends JUnitSuite {
190
187
" concat(" + _ + " )" -> " [unnecessary because we can use `++` instead or `Observable(o1, o2, ...).concat`]"
191
188
).drop(1 ).toMap ++ List .iterate(" T" , 10 )(s => s + " , T" ).map(
192
189
// all 10 overloads of from:
193
- " from(" + _ + " )" -> " apply (T*)"
190
+ " from(" + _ + " )" -> " [use `items (T*)`] "
194
191
).toMap ++ (3 to 9 ).map(i => {
195
192
// zip3-9:
196
193
val obsArgs = (1 to i).map(j => s " Observable[_ <: T $j], " ).mkString(" " )
@@ -232,6 +229,8 @@ class CompletenessTest extends JUnitSuite {
232
229
// TODO how can we filter out instance methods which were put into companion because
233
230
// of extends AnyVal in a way which does not depend on implementation-chosen name '$extension'?
234
231
.filter(! _.contains(" $extension" ))
232
+ // `access$000` is public. How to distinguish it from others without hard-code?
233
+ .filter(! _.contains(" access$000" ))
235
234
}
236
235
237
236
// also applicable for Java types
@@ -389,7 +388,10 @@ class CompletenessTest extends JUnitSuite {
389
388
def escape (s : String ) = s.replaceAllLiterally(" [" , " <" ).replaceAllLiterally(" ]" , " >" )
390
389
391
390
println("""
392
- ## Comparison of Scala Observable and Java Observable
391
+ ---
392
+ layout: comparison
393
+ title: Comparison of Scala Observable and Java Observable
394
+ ---
393
395
394
396
Note:
395
397
* This table contains both static methods and instance methods.
0 commit comments