Last active
August 30, 2017 07:21
-
-
Save novodimaporo/06be7555fb579bd2a58392122f81a917 to your computer and use it in GitHub Desktop.
playing with rxjava2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun observable1() = | |
Observable.fromCallable { | |
print("new callable 1\n") | |
true | |
} | |
fun observable2() = | |
Observable.fromCallable { | |
print("new callable 2\n") | |
true | |
} | |
fun observable3() = | |
Observable.interval(1, TimeUnit.SECONDS).map{1} | |
fun transformer() = | |
ObservableTransformer<Int, Unit> { | |
Observable.combineLatest( | |
observable1(), | |
observable2(), | |
it, | |
Function3 { t1, t2, t3 -> print("t1: $t1 t2: $t2 t3: $t3") } | |
) | |
} | |
fun main(args: Array<String>){ | |
observable3().compose(transformer()).subscribe() | |
while (true) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The result