getOrPut

fun getOrPut(key: String, defaultValue: () -> NBT): NBT

Returns the value for the given key. If the key is not found in the compound, calls the defaultValue function, puts its result into the compound under the given key and returns it.