https://kotlinlang.org logo
#coroutines
Title
# coroutines
m

mzgreen

11/13/2019, 11:07 AM
In
CoroutineScope(Dispatchers.Main + job)
the order of contexts doesn’t matter and it’s the same if I call
CoroutineScope(job + Dispatchers.Main)
, right?
s

sikri

11/13/2019, 11:14 AM
TL;DR Almost, but I suppose it doesn’t matter for end user. Both
Job
and
CoroutineDispatcher
are
CoroutineContext
and
fun operator plus
combines them and its subelements. But if element of context on the right side has same key as the element on the left side, that element with that key of the left side context won’t be used.
m

mzgreen

11/13/2019, 11:18 AM
Got it, thank you!
3 Views