: ViewModel() { private val searchWord: MutableLiveData<String> = MutableLiveData() private val mutableCurryLiveData: MutableLiveData<List<Curry>> = MutableLiveData() private val searchCurryLiveData: LiveData<List<Curry>> = Transformations.switchMap(searchWord) { word -> curryLiveDataFactory.create(word) } val curryLiveData: LiveData<List<Curry>> = MediatorLiveData<List<Curry>>().apply { addSource(mutableCurryLiveData) { value = it } addSource(searchCurryLiveData) { value = it } } fun check(id: Long) { checkCurryUseCase.execute() .doOnSubscribe { val snapshot = searchCurryLiveData.value!! changeCheckState( snapshot, snapshot.find { it.id == id }!!, true ) } .subscribeBy(onError = {}) } private fun changeCheckState(snapshot: List<Curry>, target: Curry, isCheck: Boolean) { val newCurry = target.copy( check = isCheck ) mutableCurryLiveData.value = snapshot.toMutableList().apply { set(snapshot.indexOf(target), newCurry) } } } ※දࣔͷ্ؔɺදهΛҰ෦লུ͍ͯ͠·͢ ↑ LiveDataΛՃ͍ͯ͘͠