https://kotlinlang.org logo
#announcements
Title
# announcements
r

rrva

06/28/2017, 1:22 PM
If I only want to modify a nested field of a data class, using
copy()
, what’s the cleanest way to write it? this obviously does not work:
val widget = widget.copy(owner = this.copy(firstName = "alfred"))
d

dagguh

06/28/2017, 1:27 PM
rrva: do you mean
val widget = widget.copy(owner = widget.owner.copy(firstName = "alfred"))
? Sharing your data classes would help us help you
4 Views