Two interesting operators we did not cover are materialize() and dematerialize(). We did not cover them in Chapter 3, Basic Operators, with all the other operators because it might have been confusing at that point in your learning curve. But hopefully, the point at which you are reading this, you understand the onNext(), onComplete(), and onError() events well enough to use an operator that abstractly packages them in a different way.
The materialize() operator will take these three events, onNext(), onComplete(), and onError(), and turn all of them into emissions wrapped in a Notification<T>. So if your source emits five emissions, you will get six emissions where the last one will be onComplete() or onError(). In the following code, we materialize an Observable emitting five strings, which are turned into six ...