martmists
11/26/2024, 10:15 AMSam
11/26/2024, 10:16 AMMutableSharedFlow
with an infinite (well, Int.MAX_VALUE
) replay cache.Sam
11/26/2024, 10:18 AMMutableStateFlow<List<T>>
, and just use its update
function to replace the entire list each time it changes.martmists
11/26/2024, 10:19 AMSam
11/26/2024, 10:21 AMMutableSharedFlow
is probably better 👍. The state flow approach is safe since update
is atomic, but you're right it could get expensive to recreate the list each time.Dmitry Khalanskiy [JB]
11/26/2024, 10:43 AMMutableStateFlow<PersistentList>
(with PersistentList
implementation from https://github.com/Kotlin/kotlinx.collections.immutable). Persistent collections support creating lists with new elements added efficiently, and there are no race conditions, as each persistent list is a separate object.Dmitry Khalanskiy [JB]
11/26/2024, 10:43 AMDmitry Khalanskiy [JB]
11/26/2024, 10:45 AM===
is used to check for equality; comparing lists element-by-element may be too inefficient in your case.martmists
11/26/2024, 1:47 PMDmitry Khalanskiy [JB]
11/26/2024, 1:57 PM