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
RxKotlin is a lightweight library that adds convenient extension functions to [RxJava](https://github.com/ReactiveX/RxJava). You can use RxJava with Kotlin out-of-the-box, but Kotlin has language features (such as [extension functions](https://kotlinlang.org/docs/reference/extensions.html)) that can streamline usage of RxJava even more. RxKotlin aims to conservatively collect these conveniences in one centralized library.
2
6
3
-
This adaptor exposes a set of Extension functions that allow a more idiomatic Kotlin usage
4
7
5
8
```kotlin
6
-
observable<String> { subscriber ->
7
-
subscriber.onNext("H")
8
-
subscriber.onNext("e")
9
-
subscriber.onNext("l")
10
-
subscriber.onNext("")
11
-
subscriber.onNext("l")
12
-
subscriber.onNext("o")
13
-
subscriber.onCompleted()
14
-
}.filter { it.isNotEmpty() }
15
-
.fold (StringBuilder()) { sb, e -> sb.append(e) }
16
-
.map { it.toString() }
17
-
.subscribe { a.received(it) }
18
-
19
-
verify(a, times(1)).received("Hello")
9
+
packagerx.lang.kotlin
10
+
11
+
importrx.Observable
12
+
13
+
funmain(args:Array<String>) {
14
+
15
+
val list =listOf("Alpha", "Beta", "Gamma", "Delta", "Epsilon")
16
+
17
+
list.toObservable() // extension function for Iterables
18
+
.filter { it.length >=5 }
19
+
.subscribeBy( // named arguments for lambda Subscribers
We welcome contributions and discussion for new features. It is recommended to file an issue first to prevent unnecessary efforts, but feel free to put in pull requests. The vision is to keep this library lightweight, with a tight and focused scope applicable to all platforms (including Android, server, and desktop). Anything specific to a particular domain (for example, [JavaFX](https://github.com/thomasnield/RxKotlinFX), [Math](https://github.com/thomasnield/rxkotlin-math), or [JDBC](https://github.com/davidmoten/rxjava-jdbc)) might be better suited as a separate project. Feel free to open discussion and we will help figure out where your functionality may belong.
0 commit comments