Kotlin is very quickly becoming one of my all-time favorite languages to play with. It is a JVM language that offers static typing, built-in null s...
For further actions, you may consider blocking this person and/or reporting abuse
Although I like Kotlin because of great features like Coroutines, Pojos are not the key feature to me. This has been solved with Lombok in Java:
It's not one line, but concise enough to me.
I will agree that there are definitely more compelling features in Kotlin than data classes. However, it feels cleaner being built into the language versus having to include Lombok's annotation processor.
Why not just move
name
andage
to the class body? This way you get a no-arg constructor by default. And you can usewith
orapply
elsewhere in code when instantiatingPerson
.