https://kotlinlang.org logo
Title
k

kevin.cianfarini

04/19/2019, 10:05 PM
Can someone ELI5 hot streams vs cold streams? I'm trying to wrap my head around Flow and I don't quite get it
o

octylFractal

04/19/2019, 10:08 PM
hot streams start producing when you create them, e.g. with
produce
-- it immediately starts generating elements, although it will stop at the first
yield
but cold streams don't start producing until their terminal operation is called -- you can
map
them,
filter
them, etc., and no processing happens, until you call something like
collect
👍 3
:yes: 2
k

kevin.cianfarini

04/19/2019, 10:13 PM
Oh well that's easy lol. When I was searching for explanations the articles got really into the weeds on the issue...
Can I ask why SQL queries are possible to be represented at a
Flow
in SQLDelite? I'm assuming its to make queries observable similar to Room?
As seen here
o

octylFractal

04/19/2019, 10:21 PM
yea, Flow is an observable replacement
k

kevin.cianfarini

04/19/2019, 10:22 PM
That's precisely the explanation I needed, thanks
z

Zach Klippenstein (he/him) [MOD]

04/23/2019, 5:00 PM