In my ViewModel I have this LiveData list:
val liveList: LiveData<List<Int>>
In my Activity, at some point I access the data in the list like this:
viewModel.liveList.value?.let { letList ->
while (letList.size < 10)
delay(100)
Some data gets added to liveList concurrently. (Above snippet doesn't run in the main thread). Will letList see these updates made to liveList? Thus, is letList still connected to liveList?
Or is letList a copy of the list in liveList made at the point in time the let is executed? Thus, if liveList happens to have less than 10 elements at this point, the while loop will never terminate, no matter how many elements are added to liveList?