Kotlin. Data class: how to update one of the parameters?
I have data class. For example:
data class Test(
val data: String,
val data2: String
)
Suppose I have a need to change one of the parameters of my data class. For this I will write the following code:
var test = Test(data = "data", data2 = "data2")
test = test.copy(data = "new_data")
But at the same time, I can make a parameter var and change it directly:
data class Test(
var data: String,
val data2: String
)
var test =...