File tree Expand file tree Collapse file tree 7 files changed +93
-48
lines changed
src/main/kotlin/io/reactivex/rxkotlin Expand file tree Collapse file tree 7 files changed +93
-48
lines changed Original file line number Diff line number Diff line change 1
- version =2.0.0-RC2
1
+ version =2.0.0
2
2
org.gradle.jvmargs =-Xms256m -Xmx1024m -XX:MaxPermSize =256m
Original file line number Diff line number Diff line change 1
1
package io.reactivex.rxkotlin
2
2
3
3
import io.reactivex.Completable
4
+ import io.reactivex.Flowable
5
+ import io.reactivex.Observable
4
6
import io.reactivex.functions.Action
5
7
import java.util.concurrent.Callable
6
8
import java.util.concurrent.Future
@@ -9,3 +11,16 @@ fun Action.toCompletable(): Completable = Completable.fromAction(this)
9
11
fun Callable <out Any >.toCompletable (): Completable = Completable .fromCallable(this )
10
12
fun Future <out Any >.toCompletable (): Completable = Completable .fromFuture(this )
11
13
fun (() -> Any ).toCompletable(): Completable = Completable .fromCallable(this )
14
+
15
+
16
+ // EXTENSION FUNCTION OPERATORS
17
+
18
+ /* *
19
+ * Merges the emissions of a Observable<Completable>. Same as calling `flatMapSingle { it }`.
20
+ */
21
+ fun Observable<Completable>.mergeAllCompletables () = flatMapCompletable { it }
22
+
23
+ /* *
24
+ * Merges the emissions of a Flowable<Completable>. Same as calling `flatMap { it }`.
25
+ */
26
+ fun Flowable<Completable>.mergeAllCompletables () = flatMapCompletable { it }
Original file line number Diff line number Diff line change @@ -61,4 +61,26 @@ inline fun <reified R : Any> Flowable<*>.ofType(): Flowable<R> = ofType(R::class
61
61
62
62
private fun <T : Any > Iterator<T>.toIterable () = object : Iterable <T > {
63
63
override fun iterator (): Iterator <T > = this @toIterable
64
- }
64
+ }
65
+
66
+ // EXTENSION FUNCTION OPERATORS
67
+
68
+ /* *
69
+ * Merges the emissions of a Flowable<Flowable<T>>. Same as calling `flatMap { it }`.
70
+ */
71
+ fun <T : Any > Flowable<Flowable<T>>.mergeAll () = flatMap { it }
72
+
73
+
74
+ /* *
75
+ * Concatenates the emissions of an Flowable<Flowable<T>>. Same as calling `concatMap { it }`.
76
+ */
77
+ fun <T : Any > Flowable<Flowable<T>>.concatAll () = concatMap { it }
78
+
79
+
80
+ /* *
81
+ * Emits the latest `Flowable<T>` emitted through an `Flowable<Flowable<T>>`. Same as calling `switchMap { it }`.
82
+ */
83
+ fun <T : Any > Flowable<Flowable<T>>.switchLatest () = switchMap { it }
84
+
85
+
86
+ fun <T : Any > Flowable<Flowable<T>>.switchOnNext (): Flowable <T > = Flowable .switchOnNext(this )
Original file line number Diff line number Diff line change 1
1
package io.reactivex.rxkotlin
2
2
3
+ import io.reactivex.Flowable
3
4
import io.reactivex.Maybe
5
+ import io.reactivex.Observable
4
6
import java.util.concurrent.Callable
5
7
import java.util.concurrent.Future
6
8
@@ -10,4 +12,18 @@ fun <T : Any> Callable<T>.toMaybe(): Maybe<T> = Maybe.fromCallable(this)
10
12
fun <T : Any > (() -> T ).toMaybe(): Maybe <T > = Maybe .fromCallable(this )
11
13
12
14
inline fun <reified R : Any > Maybe<Any>.cast (): Maybe <R > = cast(R ::class .java)
13
- inline fun <reified R : Any > Maybe<Any>.ofType (): Maybe <R > = ofType(R ::class .java)
15
+ inline fun <reified R : Any > Maybe<Any>.ofType (): Maybe <R > = ofType(R ::class .java)
16
+
17
+
18
+
19
+ // EXTENSION FUNCTION OPERATORS
20
+
21
+ /* *
22
+ * Merges the emissions of a Observable<Maybe<T>>. Same as calling `flatMapMaybe { it }`.
23
+ */
24
+ fun <T : Any > Observable<Maybe<T>>.mergeAllMaybes () = flatMapMaybe { it }
25
+
26
+ /* *
27
+ * Merges the emissions of a Flowable<Maybe<T>>. Same as calling `flatMap { it }`.
28
+ */
29
+ fun <T : Any > Flowable<Maybe<T>>.mergeAllMaybes () = flatMapMaybe { it }
Original file line number Diff line number Diff line change @@ -61,4 +61,25 @@ inline fun <reified R : Any> Observable<*>.ofType(): Observable<R> = ofType(R::c
61
61
62
62
private fun <T : Any > Iterator<T>.toIterable () = object : Iterable <T > {
63
63
override fun iterator (): Iterator <T > = this @toIterable
64
- }
64
+ }
65
+
66
+
67
+ // EXTENSION FUNCTION OPERATORS
68
+
69
+ /* *
70
+ * Merges the emissions of an Observable<Observable<T>>. Same as calling `flatMap { it }`.
71
+ */
72
+ fun <T : Any > Observable<Observable<T>>.mergeAll () = flatMap { it }
73
+
74
+ /* *
75
+ * Concatenates the emissions of an Observable<Observable<T>>. Same as calling `concatMap { it }`.
76
+ */
77
+ fun <T : Any > Observable<Observable<T>>.concatAll () = concatMap { it }
78
+
79
+ /* *
80
+ * Emits the latest `Observable<T>` emitted through an `Observable<Observable<T>>`. Same as calling `switchMap { it }`.
81
+ */
82
+ fun <T : Any > Observable<Observable<T>>.switchLatest () = switchMap { it }
83
+
84
+ fun <T : Any > Observable<Observable<T>>.switchOnNext (): Observable <T > = Observable .switchOnNext(this )
85
+
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
package io.reactivex.rxkotlin
2
2
3
+ import io.reactivex.Flowable
4
+ import io.reactivex.Observable
3
5
import io.reactivex.Single
4
6
import java.util.concurrent.Callable
5
7
import java.util.concurrent.Future
@@ -10,3 +12,16 @@ fun <T : Any> Callable<T>.toSingle(): Single<T> = Single.fromCallable(this)
10
12
fun <T : Any > (() -> T ).toSingle(): Single <T > = Single .fromCallable(this )
11
13
12
14
inline fun <reified R : Any > Single<Any>.cast (): Single <R > = cast(R ::class .java)
15
+
16
+
17
+ // EXTENSION FUNCTION OPERATORS
18
+
19
+ /* *
20
+ * Merges the emissions of a Observable<Single<T>>. Same as calling `flatMapSingle { it }`.
21
+ */
22
+ fun <T : Any > Observable<Single<T>>.mergeAllSingles () = flatMapSingle { it }
23
+
24
+ /* *
25
+ * Merges the emissions of a Flowable<Single<T>>. Same as calling `flatMap { it }`.
26
+ */
27
+ fun <T : Any > Flowable<Single<T>>.mergeAllSingles () = flatMapSingle { it }
You can’t perform that action at this time.
0 commit comments