<How does Kotlin's data class copy idiom look for ...
# stackoverflow
u
How does Kotlin's data class copy idiom look for nullable types? I have some code which looks like this, where param is of a data class type: val options = if (param.language == null) { param.copy(language = default()) } else { param } Now, however, the language object has been moved into a hierarchy of nullable objects, so the check must look like this: if (param.subObj?.nextObj?.language == null) { ... } How do I use the copy idiom in this case?