“ It was about 50 lines of code.
Stian Drøbak
164

In Kotlin you can define a data class like this:

data class Person(val name: String, var address: String?)

That generates the getters, setters, toString, equals, hashCode, and other methods like copy() which lets you make a duplicate with new values for named fields (via named arguments), and component[1234]() which let you spread the class out into separate variables.

Java is pretty verbose. When you add in all the code for constructors getters setters and other methods you can easily reach 50 LOC.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.