Kotlin 1.4 what’s new

Kotlin is certainly a beautiful language and for developers having such a language enhances productivity and reduces the development time and effort. The best thing about kotlin is the active development in the ecosystem where new feature gets added as the new version gets released and those new features even enhance the productivity of developers.

With Kotlin 1.4 we have some handy language features which are helpful to write a concise and effective program.

A single abstract method is a great way to reduce interface callback with lambda provided you have a single method in the interface. With SAM you can also create generic operation methods like below

Callable reference with default argument
While using higher-order function it’s possible to pass another function as a parameter, so how about having an ability to pass those functions directly which are having some default argument like below

Trailing comma
It’s one of the most common practices to remove the comma from the last argument of the function but this tends to add an overhead of adding those during development as parameter changes for the function so now with kotlin 1.4 it’s possible to leave the trailing comma at the end of the last parameter.

Exit from the loop through the break and continue
In the case of for loop if there are any sort of necessity to either exit the loop through a break or continue it using the continue keyword those things are now straightforward.

Named arguments
Kotlin had a limitation that you cannot use named argument with starting or mid parameter as named argument and access other without name, now it’s possible to use named argument at any position.

New in collection
There are new APIs for collection also which could be helpful during app development especially like below

These are few of the updates about what’s new in Kotlin 1.4 apart from these there are many more new features like new complier, coroutine debugger, gradle dls, performance improvements and many more.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store