what is default value of String?
btw you can have such function if you add the default value to constructor
Copy code
data class User(
val id: String = "",
val deviceId: String = ""
)
k
KamilH
10/16/2020, 8:14 AM
I would say empty string isn’t it? When field is nullable then null, when field is
Int
then 0, etc 🙂
Yea, sure default values in constructor is always an option, but those functions I’m using in unit tests and I wouldn’t like to write default values because of correctness of using them in app (it would be easy to forget to initialize some value, because IDE would allow for it)