June 2017
Intermediate to advanced
400 pages
8h 44m
English
Observable.defer() is a powerful factory due to its ability to create a separate state for each Observer. When using certain Observable factories, you may run into some nuances if your source is stateful and you want to create a separate state for each Observer. Your source Observable may not capture something that has changed about its parameters and send emissions that are obsolete. Here is a simple example: we have an Observable.range() built off two static int properties, start and count.
If you subscribe to this Observable, modify the count, and then subscribe again, you will find that the second Observer does not see this change:
import io.reactivex.Observable; public class Launcher { private static int start = ...
Read now
Unlock full access