https://kotlinlang.org logo
Title
m

marcelo

10/09/2018, 2:42 AM
I can mutate the value??
n

nfrankel

10/09/2018, 7:57 AM
the fact that it’s a data class has nothing to do with the fact its properties are mutable or not from the docs (https://kotlinlang.org/docs/reference/data-classes.html):
All primary constructor parameters need to be marked as val or var
data class just means some functions are automatically generated
of course, it includes
equals()
and
hashCode()
so you need to figure out how it works with mutability in your case
(only properties declared in the constructor are used in function generation if you move your value to the body, it’s fine
m

marcelo

10/09/2018, 8:16 PM
Thanks Nicolas!
👍 1