December 2017
Intermediate to advanced
322 pages
7h 3m
English
Take a careful look at all the previous examples. In all the examples, if you subscribe to the same Observable multiple times, you will get the emissions from the beginning for all the subscriptions. Don't believe it? Take a look at the following example:
fun main(args: Array<String>) {
val observable: Observable<String> = listOf ("String 1","String 2","String 3","String 4").toObservable()//1
observable.subscribe({//2
println("Received $it")
},{
println("Error ${it.message}")
},{
println("Done")
})
observable.subscribe({//3
println("Received $it")
},{
println("Error ${it.message}")
},{
println("Done")
})
}
Here is its output:
The program is quite straightforward. Declared an Observable on comment 1, subscribed to the ...
Read now
Unlock full access