December 2017
Intermediate to advanced
322 pages
7h 3m
English
Thanks to the extension functions of Kotlin, you can turn any Iterable instance, such as List, to Observable without much effort; we have already used this method in Chapter 1, A Short Introduction to Reactive Programming, however, take a look at this:
fun main(args: Array<String>) {
val observer: Observer<String> = object : Observer<String> {
override fun onComplete() {
println("All Completed")
}
override fun onNext(item: String) {
println("Next $item")
}
override fun onError(e: Throwable) {
println("Error Occured ${e.message}")
}
override fun onSubscribe(d: Disposable) {
println("New Subscription ")
}
}//Create Observer
val list:List<String> = listOf ("String 1","String 2","String 3","String ...Read now
Unlock full access