1.SAM conversion for Kotlin classes.

2. Explicit API mode .

3. Trailing comma .

4. Break and continue inside when expressions.

5. Mixing named and positional arguments.

7. New type inference.

8. Unified exception type for null checks.

In this post we are going discuss the introduced ‘trailing comma’ feature. It is a small feature that makes life of the developer a bit easier.

Image a situation when you define list of objects :

Later you decide to swap the elements :

Now you get an error because of not having a comma between the elements of the list.

This can be resolved using trailing comma:

Now you can swap the items however you want without worrying, where that extra comma needs to be added.

The same rule applies to functions and classes :

--

--