Jintin
01/27/2021, 3:52 PMSingle.just
is a hot observable or not.
I feel it's not but seems many people think it is. Is there any rule we can follow how to determine it?Zach Klippenstein (he/him) [MOD]
01/27/2021, 4:08 PMZach Klippenstein (he/him) [MOD]
01/27/2021, 4:13 PMval hotSingle = Single.just(1)
vs
val coldSingle = Single.fromCallable { 1 }
There’s no distinction if the value you’re emitting is a value type. And even if it isn’t, is this hot or cold?
val value = 1
val idkSingle = Single.fromCallable { value }
Zach Klippenstein (he/him) [MOD]
01/27/2021, 4:15 PMJintin
01/27/2021, 4:23 PMA "hot" Observable may begin emitting items as soon as it is created, and so any observer who later subscribes to that Observable may start observing the sequence somewhere in the middle.
So I feel it's cold as the subscribe didn't affect the value emit and there's no chance to miss the value as well, is it make sense?Zach Klippenstein (he/him) [MOD]
01/27/2021, 5:01 PM