An Observable can be hot or cold depending upon when it starts emitting the items. If an Observable starts emitting elements immediately after its creation, it becomes a hot Observable. In such situations, the Observer can start using the items anytime at the middle of the emission process, leading to a problem of knowing only a part of the emitted sequence.
To make it simple, let's take an example where we will generate a random number and will push it to the observer. Have a look at the following code:
public class Demo_Hot_Observable { public static void main(String[] args) { ConnectableObservable observable =
Observable.create(observer -> { observer.onNext("I am Hot Observable "+Math.random()*100); observer.onComplete(); }).publish(); observable.subscribe(consumer...