Skip to content

Commit 8397f74

Browse files
committed
Replace '+' with '::'
1 parent 6dcc9d3 commit 8397f74

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

language-adaptors/rxjava-scala/src/examples/scala/rx/lang/scala/examples/RxScalaDemo.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,9 @@ class RxScalaDemo extends JUnitSuite {
780780
}
781781

782782
@Test def startWithExample1(): Unit = {
783-
val o = List(2, 3).toObservable + 1
784-
assertEquals(List(1, 2, 3), o.toBlockingObservable.toList)
783+
val o1 = List(3, 4).toObservable
784+
val o2 = 1 :: 2 :: o1
785+
assertEquals(List(1, 2, 3, 4), o2.toBlockingObservable.toList)
785786
}
786787

787788
@Test def startWithExample2(): Unit = {

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Observable.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ trait Observable[+T]
247247
* @param elem the item to emit
248248
* @return an Observable that emits the specified item before it begins to emit items emitted by the source Observable
249249
*/
250-
def +[U >: T](elem: U): Observable[U] = {
250+
def ::[U >: T](elem: U): Observable[U] = {
251251
val thisJava = this.asJavaObservable.asInstanceOf[rx.Observable[U]]
252252
toScalaObservable(thisJava.startWith(elem))
253253
}

language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/CompletenessTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class CompletenessTest extends JUnitSuite {
167167
"zip(Iterable[_ <: Observable[_]], FuncN[_ <: R])" -> "[use `zip` in companion object and `map`]"
168168
) ++ List.iterate("T", 9)(s => s + ", T").map(
169169
// all 9 overloads of startWith:
170-
"startWith(" + _ + ")" -> "[unnecessary because we can just use `+` instead]"
170+
"startWith(" + _ + ")" -> "[unnecessary because we can just use `::` instead]"
171171
).toMap ++ List.iterate("Observable[_ <: T]", 9)(s => s + ", Observable[_ <: T]").map(
172172
// concat 2-9
173173
"concat(" + _ + ")" -> "[unnecessary because we can use `++` instead or `Observable(o1, o2, ...).concat`]"

0 commit comments

Comments
 (0)