Skip to content

Instantly share code, notes, and snippets.

@ismailgungor
Last active November 27, 2019 21:57
Show Gist options
  • Save ismailgungor/c1e6c036852662f4e5babcc17e4db7e9 to your computer and use it in GitHub Desktop.
Save ismailgungor/c1e6c036852662f4e5babcc17e4db7e9 to your computer and use it in GitHub Desktop.
val anyList: List<Any> = listOf("One", 2, "Three", "Four", 4.5, "Five", 6.0f)
val observable: Observable<Any> = anyList.toObservable()
val observer: Observer<Any> = object : Observer<Any> {
override fun onComplete() {
log("All Completed")
}
override fun onSubscribe(d: Disposable) {
log("Suscribed to $d")
}
override fun onNext(t: Any) {
log("Next $t" + " / " + t::class)
}
override fun onError(e: Throwable) {
log("Error Occured $e")
}
}
observable.subscribe(observer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment