@@ -236,6 +236,16 @@ trait Observable[+T]
236
236
toScalaObservable[U ](asJavaObservable.multicast[R , U ](subjectFactoryJava, selectorJava))
237
237
}
238
238
239
+ /**
240
+ * Returns an Observable that first emits the items emitted by `this`, and then `elem`.
241
+ *
242
+ * @param elem the item to be appended
243
+ * @return an Observable that first emits the items emitted by `this`, and then `elem`.
244
+ */
245
+ def :+ [U >: T ](elem : U ): Observable [U ] = {
246
+ this ++ Observable .items(elem)
247
+ }
248
+
239
249
/**
240
250
* Returns an Observable that first emits the items emitted by `this`, and then the items emitted
241
251
* by `that`.
@@ -261,57 +271,11 @@ trait Observable[+T]
261
271
* @param elem the item to emit
262
272
* @return an Observable that emits the specified item before it begins to emit items emitted by the source Observable
263
273
*/
264
- def : : [U >: T ](elem : U ): Observable [U ] = {
274
+ def + : [U >: T ](elem : U ): Observable [U ] = {
265
275
val thisJava = this .asJavaObservable.asInstanceOf [rx.Observable [U ]]
266
276
toScalaObservable(thisJava.startWith(elem))
267
277
}
268
278
269
- /**
270
- * Returns an Observable that emits the items in a specified `Observable` before it begins to emit
271
- * items emitted by the source Observable.
272
- * <p>
273
- * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/startWith.o.png">
274
- *
275
- * @param that an Observable that contains the items you want the modified Observable to emit first
276
- * @return an Observable that emits the items in the specified `Observable` and then emits the items
277
- * emitted by the source Observable
278
- */
279
- def startWith [U >: T ](that : Observable [U ]): Observable [U ] = {
280
- val thisJava = this .asJavaObservable.asInstanceOf [rx.Observable [U ]]
281
- val thatJava = that.asJavaObservable.asInstanceOf [rx.Observable [U ]]
282
- toScalaObservable(thisJava.startWith(thatJava))
283
- }
284
-
285
- /**
286
- * Returns an Observable that emits the items in a specified `Iterable` before it begins to emit items
287
- * emitted by the source Observable.
288
- * <p>
289
- * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/startWith.png">
290
- *
291
- * @param iterable an Iterable that contains the items you want the modified Observable to emit first
292
- * @return an Observable that emits the items in the specified `Iterable` and then emits the items
293
- * emitted by the source Observable
294
- */
295
- def startWith [U >: T ](iterable : Iterable [U ]): Observable [U ] = {
296
- val thisJava = this .asJavaObservable.asInstanceOf [rx.Observable [U ]]
297
- toScalaObservable(thisJava.startWith(iterable.asJava))
298
- }
299
-
300
- /**
301
- * 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.
302
- * <p>
303
- * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/startWith.s.png">
304
- *
305
- * @param iterable an Iterable that contains the items you want the modified Observable to emit first
306
- * @param scheduler the Scheduler to emit the prepended values on
307
- * @return an Observable that emits the items in the specified `Iterable`, on a specified `Scheduler`, and then emits the items
308
- * emitted by the source Observable
309
- */
310
- def startWith [U >: T ](iterable : Iterable [U ], scheduler : Scheduler ): Observable [U ] = {
311
- val thisJava = this .asJavaObservable.asInstanceOf [rx.Observable [U ]]
312
- toScalaObservable(thisJava.startWith(iterable.asJava, scalaSchedulerToJavaScheduler(scheduler)))
313
- }
314
-
315
279
/**
316
280
* Returns an Observable that emits the items emitted by several Observables, one after the
317
281
* other.
@@ -1419,7 +1383,7 @@ trait Observable[+T]
1419
1383
* @return an Observable that emits `true` if the specified item is emitted by the source Observable,
1420
1384
* or `false` if the source Observable completes without emitting that item
1421
1385
*/
1422
- def contains (elem : Any ): Observable [Boolean ] = {
1386
+ def contains [ U >: T ] (elem : U ): Observable [Boolean ] = {
1423
1387
exists(_ == elem)
1424
1388
}
1425
1389
@@ -2866,7 +2830,7 @@ trait Observable[+T]
2866
2830
* <p>
2867
2831
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/doOnTerminate.png">
2868
2832
* <p>
2869
- * This differs from `finallyDo` in that this happens BEFORE onCompleted/onError are emitted.
2833
+ * This differs from `finallyDo` in that this happens **before** ` onCompleted/onError` are emitted.
2870
2834
*
2871
2835
* @param onTerminate the action to invoke when the source Observable calls `onCompleted` or `onError`
2872
2836
* @return the source Observable with the side-effecting behavior applied
0 commit comments