5 cool features you should know about Kotlin

5 cool features of Kotlin
5 cool features of Kotlin

After starting my work on Kotlin, I realized that this language will change my life, and you know what? I was totally right. Here is my list of five less known things about Kotlin and I hope you will find at least three worth knowing.

Name your imports

In Kotlin, imports are used by the compiler to let you name your classes by their unqualified name.

Change companion object name

Companion object was introduced to replace static members. It is not only for declaring static properties but also to name them.

Compose functions

I bet you used function references before but have you ever tried to use them to compose functions? Imagine that you want to map an array of prices to prices that are taxed, discounted and rounded.

Change name of generated class

Extension functions are one of the most attractive features in Kotlin but using them in Java code can give you a serious headache. It is ugly and besides is nothing else like invoking a static method.

Validate an assignment and “veto” it

The way in which Kotlin handles delegation is pretty spectacular so if you are not familiar with it, you should totally check my article: “Zero boilerplate delegation in Kotlin”.


Full article here>>: 5 cool things you probably don’t know about Kotlin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s