| 164 | var liveData: LiveData<Y>? = null |
| 165 | |
| 166 | override fun onChanged(value: X) { |
| 167 | val newLiveData = switchMapFunction.apply(value) |
| 168 | if (liveData === newLiveData) { |
| 169 | return |
| 170 | } |
| 171 | if (liveData != null) { |
| 172 | result.removeSource(liveData!!) |
| 173 | } |
| 174 | liveData = newLiveData |
| 175 | if (liveData != null) { |
| 176 | result.addSource(liveData!!) { y -> result.setValue(y) } |
| 177 | } |
| 178 | } |
| 179 | }, |
| 180 | ) |
| 181 | return result |
nothing calls this directly
no test coverage detected