Hi, I want to define list of operations that will ...
# coroutines
g
Hi, I want to define list of operations that will be executed later. What is better solution in this case? •
List<Deffered<T>>
List<suspend () -> T>
👍 2
o
`Deferred`s are usually already executed, unless you start them as LAZY
so in general I would think the latter better represents it
g
cool, thank you
btw, should I use
Flow
, if I want this operation to produce multiple values?
o
are you thinking like
List<Flow<T>>
or just a
Flow<T>
? either works, they're just slightly different
g
the first one
o
unlike
Deferred
,
Flow
is usually cold/lazy, so I think using it directly is correct there
g
ok, and if I want to create a constructor-function for that suspend-functions, should it look like
fun x(): suspend () -> T
? Or there may be a better syntax?
o
I think that's the syntax, yes
g
Thank you a lot for your time!