You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: language-adaptors/rxjava-scala/README.md
+65-2Lines changed: 65 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,71 @@
1
1
# Scala Adaptor for RxJava
2
2
3
-
There's an old Scala adaptor ( `rx.lang.scala.RxImplicits` with test `rx.lang.scala.RxImplicitsTest` ), which is deprecated. All other classes in `rx.lang.scala` belong to the new adaptor.
3
+
This adaptor allows to use RxJava in Scala with anonymous functions, e.g.
Further, this adaptor attempts to expose an API which is as Scala-idiomatic as possible. This means that certain methods have been renamed, their signature was changed, or static methods were changed to instance methods. Some examples:
20
+
21
+
```scala
22
+
// instead of concat:
23
+
def++[U>:T](that: Observable[U]):Observable[U]
24
+
25
+
// instance method instead of static:
26
+
defzip[U](that: Observable[U]):Observable[(T, U)]
27
+
28
+
// the implicit evidence argument ensures that dematerialize can only be called on Observables of Notifications:
// Java's from becomes apply, and we use Scala Range
53
+
defapply(range: Range):Observable[Int]
54
+
55
+
// use Bottom type:
56
+
defnever:Observable[Nothing]
57
+
```
58
+
59
+
Also, the Scala Observable is fully covariant in its type parameter, whereas the Java Observable only achieves partial covariance due to limitations of Java's type system (or if you can fix this, your suggestions are very welcome).
60
+
61
+
For more examples, see [RxScalaDemo.scala](https://github.com/Netflix/RxJava/blob/master/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/examples/RxScalaDemo.scala).
62
+
63
+
Scala code using Rx should only import members from `rx.lang.scala` and below.
64
+
65
+
Work on this adaptor is still in progress, and for the moment, the best source of documentation are the comments in the source code of [`rx.lang.scala.Observable`](https://github.com/Netflix/RxJava/blob/master/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Observable.scala).
66
+
67
+
68
+
## Binaries
6
69
7
70
Binaries and dependency information for Maven, Ivy, Gradle and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22rxjava-scala%22).
0 commit comments