Best IDE for Kotlin coders

Kotlin is young language that is designed as an "improved Java". As for all new products, the issue of choosing an IDE is especially acute. Lets take a good look on a IDEs market for Kotlin
14 June 2017   3706

Kotlin is the programming language created by JetBrains. This company is known for its IDEs, therefore at least one specialized IDE for Kotlin exists. However, it is fully compatible with Java, so you can use any platform that works with Java to code Kotlin.

Kotlin

Statically-typed programming language that runs on the Java Virtual Machine and also can be compiled to JavaScript source code

However, this is not the only option. Despite Kotlin's youth, several development environments have already appeared that fully integrated with it. So let's figure out whether it's worth making choices in favor of such solutions or you can just use the standard IDE for Java.

TryKotlin

Platforms: A cloud-based application available in the browser for any operating system.

Price: freeware.

try kotlin interfaceTryKotlin interface

Features:

  • Simple text editor for Kotlin, created by JetBrains to demonstrate the features of this language and the first acquaintance with its features;
  • A Java Virtual Machine that allows to run the code immediately;
  • Modular testing of JUnit;
  • JavaScript and Canvas support;
  • Examples of ready-made code for basic Kotlin functions;
  • Java to  Kotlin code converter;
  • The ability to save written code in a separate file and share it in social networks.

Download link.

TruKotlin video demonstation.

IntelliJ IDEA

Platforms: Windows, Linux, Mac OS.

Trial version: a 30-day trial version is available, which can be extended upon request to 90 days.

Price: license is purchased for a certain period of time. For private use IntelliJ IDEA will cost $ 149 for the year or $ 14.9 for the month. For corporate - $ 499 and $ 49.9. Startups can receive a 50% discount for three years. The Community Edition is free, it is designed to work with Java SE, Groovy, Scala.

intellij idea interfaceInterface of IntelliJ IDEA

Features:

  • IDE from the creators of Kotlin;
  • Compatible with Apache, JUnit, CVS, Subversion;
  • A large selection of refactoring tools for fast code reorganization;
  • Software testing tools, including code coverage analysis;
  • Java EE specifications and all popular Java frameworks: Spring, JSF, Hibernate and others are supported;
  • JavaScript, HTML, CSS, Ruby, Python supported.

Download link.

IntelliJ IDEA video review on the official developers' channel.

Android Studio

Platforms: Windows, Linux, Mac OS.

Price: freeware.

android studio interfaceAndroid Studio interface

Features:

  • IDE is based on IntelliJ IDEA and designed to create mobile applications for Android;
  • In May 2017, Google, the developer of Android Studio, announced the introduction of full support for Kotlin in its product;
  • Editing the interface of mobile applications in a visual editor using Drag-and-Drop;
  • View the layout on screens with different resolutions;
  • Automatic assembly and generation of .apk files using Gradle;
  • Code refactoring, search tools for performance problems and version incompatibilities;
  • Standard components and Android templates.

Download link.

Announcement of Kotlin support implementation in Android Studio 3.0.

Vim

Platforms: Windows, Mac OS, Linux, iOS, Android.

Price: freeware. Work with Kotlin requires a plugin.

vim interface
Vim interface

Features:

  • Vim is one of the most customizable text editors. It supports the saving of undo operations even after the program is closed, clipboard switching, automatic creation of the workpiece of the scripts;
  • Works in the mode of insertion, console and visual. Simultaneous opening of several files, window management;
  • Simple expansion of the editor with other languages ​​due to the large database of plugins;
  • Support syntax highlighting, automatic indentation, code checking with Syntastic;
  • The plugin is recommended on the official  page.

Download link and plugin link.

Sublime Text

Platforms: Windows, Linux, Mac OS.

Price: free application, however with periodic notification to buy a license. The cost is $ 70. Work with Kotlin needs a plugin.

sublime text interface
Sublime Text at work

Features:

  • Full support for Kotlin: syntax highlighting, errors detection, autocompletion;
  • Create your own templates and commands and quickly insert them into a file;
  • Built-in Java-compiler JavaC;
  • Ability to create own extensions;
  • The plugin is recommended on the official Kotlin page.

Download link and plugin link.

Which IDE is the best for Kotlin?

Kotlin is the programming language by JetBrains, a well-known developers from Saint-Petersburg, Russia. It is the 2nd official supported language for Android application development. We've collected the best IDEs for this language. Please, share your thoughts about the best Kotlin IDE in your opinion.

How to convert list to map in Kotlin

Two ways to convert list to map in Kotlin, with code examples
31 October 2017   534

For example, you have a list of strings like:

val list = listOf("a", "b", "c", "d")

and you need to convert it to a map, where the strings are the keys.

There are two ways to do this:

The first and most performant is to use associateBy function that takes two lambdas for generating the key and value, and inlines the creation of the map:

val map = friends.associateBy({it.facebookId}, {it.points})

The second, less performant, is to use the standard map function to create a list of Pair which can be used by toMap to generate the final map:

val map = friends.map { it.facebookId to it.points }.toMap()