scottiedog45
02/23/2021, 12:26 AMval cannot be reassigned error, i think because i don't want to assign the local value in the forEach closure, but the property of the parent class. How could I do something like this?
listOf<Job?>(
uiJob,
authJob,
videoEventsJob,
videoJob,
countdownJob
).forEach {
it?.cancel()
it = null
}Endre Deak
02/23/2021, 12:32 AMmap instead and then deal with the output listephemient
02/23/2021, 12:56 AM.mapNotNull { ... } which is equivalent to .map { ... }.filterNotNull()CFrei
02/23/2021, 8:48 AMvar l = listOf<Job?>...map( it?.cancel() ) could work, depending of what cancel() returns.Zach Klippenstein (he/him) [MOD]
02/23/2021, 3:59 PMscottiedog45
02/23/2021, 7:32 PM