Is the `toString` method of data classes determini...
# announcements
j
Is the
toString
method of data classes deterministric? Or the order of fields isn't guaranteed?
i
It is.
The toString method is generated statically during compilation, and the order of fields is equal to their order in the class's definition.
e.g.:
data class Unary(val operation: String, val value: MST) : MST()
->
Copy code
public String toString() {
   return "Unary(operation=" + this.operation + ", value=" + this.value + ")";
}
j
Cool, thanks!