June 2017
Intermediate to advanced
400 pages
8h 44m
English
When you start creating your own Transformers and custom operators (covered later), an easy way to shoot yourself in the foot is to share states between more than one subscription. This can quickly create unwanted side effects and buggy applications and is one of the reasons you have to tread carefully as you create your own operators.
Say, you want to create an ObservableTransformer<T,IndexedValue<T>>, which pairs each emission with its consecutive index starting at 0. First, you create an IndexedValue<T> class to simply pair each T value with an int index:
static final class IndexedValue<T> { final int index; final T value; IndexedValue(int index, T value) { this.index = index; this.value = value; ...Read now
Unlock full access