I was wondering about the syntax for constructors in Kotlin. How do deal with them in an optically pleasing way?
data class Person(val firstName: String,
var lastName: String,
val age: Int) {
data class Person(
val firstName: String,
var lastName: String,
val age: Int
) {
data class Person(val firstName: String, var lastName: String, val age: Int) {
data class Person(val firstName: String,
var lastName: String,
val age: Int)
{
I’m not really feeling comfortable with wrapping the properties in () followed by { because it just doesn’t read nicely, especially for longer lists. It’s getting even messier when you start adding modifiers to those properties. Can you specify getters/setters for properties initialized in the constructor?
How is everybody else dealing with this?