We discussed in depth about the emission of the items from Observable, which will be consumed by Subscriber. Not necessary all the emitted items every time needs to be consumed. It all depends on the scenario the developers are dealing with. We need to have a way to discard the resources which are in use. The Subscriber doesn't have such method. However, the Disposable interface provides the useful dispose() method. The Disposable interface is shown as follows:
public interface Disposable {
void dispose(); boolean isDisposed();
}
The nonfunctional interface, Disposable, is now responsible for life cycle management of streams and resources. Now, subscribing Observable happens when someone uses DisposableObserver and to unsubscribe the dispose() method, it needs to be invoked which is analogous to the Subscription.cancel...