I want to achieve something like this in kotlin. I have seen people do the same thing on Java. How do I do it in Kotlin?