getOrPut

fun <K, V> MutableLiveData<Map<K, V>>.getOrPut(key: K, defaultValue: () -> V): V

Returns the value for the given key in the LiveData's value. If the key is not found, calls the defaultValue function, puts its result into the map under the given key and returns it. Creates a map if the LiveData has no value yet.