@@ -222,6 +222,16 @@ trait Observable[+T]
222
222
(() => javaCO.connect(), toScalaObservable(javaCO))
223
223
}
224
224
225
+ /**
226
+ * Returns an Observable that first emits the items emitted by `this`, and then `elem`.
227
+ *
228
+ * @param elem the item to be appended
229
+ * @return an Observable that first emits the items emitted by `this`, and then `elem`.
230
+ */
231
+ def :+ [U >: T ](elem : U ): Observable [U ] = {
232
+ this ++ Observable .items(elem)
233
+ }
234
+
225
235
/**
226
236
* Returns an Observable that first emits the items emitted by `this`, and then the items emitted
227
237
* by `that`.
@@ -247,57 +257,11 @@ trait Observable[+T]
247
257
* @param elem the item to emit
248
258
* @return an Observable that emits the specified item before it begins to emit items emitted by the source Observable
249
259
*/
250
- def : : [U >: T ](elem : U ): Observable [U ] = {
260
+ def + : [U >: T ](elem : U ): Observable [U ] = {
251
261
val thisJava = this .asJavaObservable.asInstanceOf [rx.Observable [U ]]
252
262
toScalaObservable(thisJava.startWith(elem))
253
263
}
254
264
255
- /**
256
- * Returns an Observable that emits the items in a specified `Observable` before it begins to emit
257
- * items emitted by the source Observable.
258
- * <p>
259
- * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/startWith.o.png">
260
- *
261
- * @param that an Observable that contains the items you want the modified Observable to emit first
262
- * @return an Observable that emits the items in the specified `Observable` and then emits the items
263
- * emitted by the source Observable
264
- */
265
- def startWith [U >: T ](that : Observable [U ]): Observable [U ] = {
266
- val thisJava = this .asJavaObservable.asInstanceOf [rx.Observable [U ]]
267
- val thatJava = that.asJavaObservable.asInstanceOf [rx.Observable [U ]]
268
- toScalaObservable(thisJava.startWith(thatJava))
269
- }
270
-
271
- /**
272
- * Returns an Observable that emits the items in a specified `Iterable` before it begins to emit items
273
- * emitted by the source Observable.
274
- * <p>
275
- * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/startWith.png">
276
- *
277
- * @param iterable an Iterable that contains the items you want the modified Observable to emit first
278
- * @return an Observable that emits the items in the specified `Iterable` and then emits the items
279
- * emitted by the source Observable
280
- */
281
- def startWith [U >: T ](iterable : Iterable [U ]): Observable [U ] = {
282
- val thisJava = this .asJavaObservable.asInstanceOf [rx.Observable [U ]]
283
- toScalaObservable(thisJava.startWith(iterable.asJava))
284
- }
285
-
286
- /**
287
- * Returns an Observable that emits the items in a specified `Iterable`, on a specified `Scheduler`, before it begins to emit items emitted by the source Observable.
288
- * <p>
289
- * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/startWith.s.png">
290
- *
291
- * @param iterable an Iterable that contains the items you want the modified Observable to emit first
292
- * @param scheduler the Scheduler to emit the prepended values on
293
- * @return an Observable that emits the items in the specified `Iterable`, on a specified `Scheduler`, and then emits the items
294
- * emitted by the source Observable
295
- */
296
- def startWith [U >: T ](iterable : Iterable [U ], scheduler : Scheduler ): Observable [U ] = {
297
- val thisJava = this .asJavaObservable.asInstanceOf [rx.Observable [U ]]
298
- toScalaObservable(thisJava.startWith(iterable.asJava, scalaSchedulerToJavaScheduler(scheduler)))
299
- }
300
-
301
265
/**
302
266
* Returns an Observable that emits the items emitted by several Observables, one after the
303
267
* other.
@@ -1133,7 +1097,7 @@ trait Observable[+T]
1133
1097
* @return an Observable that emits `true` if the specified item is emitted by the source Observable,
1134
1098
* or `false` if the source Observable completes without emitting that item
1135
1099
*/
1136
- def contains (elem : Any ): Observable [Boolean ] = {
1100
+ def contains [ U >: T ] (elem : U ): Observable [Boolean ] = {
1137
1101
exists(_ == elem)
1138
1102
}
1139
1103
@@ -2580,7 +2544,7 @@ trait Observable[+T]
2580
2544
* <p>
2581
2545
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/doOnTerminate.png">
2582
2546
* <p>
2583
- * This differs from `finallyDo` in that this happens BEFORE onCompleted/onError are emitted.
2547
+ * This differs from `finallyDo` in that this happens **before** ` onCompleted/onError` are emitted.
2584
2548
*
2585
2549
* @param onTerminate the action to invoke when the source Observable calls `onCompleted` or `onError`
2586
2550
* @return the source Observable with the side-effecting behavior applied
0 commit comments