Android Developers

Articles on modern tools and resources to help you build experiences that people love, faster and easier, across every Android device.

Kotlin Standard Functions cheat-sheet

--

Last week I tweeted about this new take on a Kotlin Standard Functions Cheat-Sheet that I find better than the traditional approach. Instead of focusing on how each function works, it provides guidance depending on what the developer wants to achieve:

Download the Kotlin Standard Functions flowchart in PNG or PDF.

Kotlin Standard Functions flowchart

It is opinionated: every decision was taken for a reason, from semantics to readability. For example: a side-effect could be executed inside an apply too, but it’s much more readable and safer to indicate it in a separate function.

It is not exhaustive: there are other use cases not covered by it. Example:run can be used to limit scope but it’s preferred to extract to a method.

It is not done: as the language evolves and patterns emerge, we’ll update it.

I also provided the traditional table:

Download the Kotlin Standard Functions table in PNG or PDF.

Links:

Thank you to everyone that contributed to the diagrams and to the conversation.

--

--

Android Developers
Android Developers

Published in Android Developers

Articles on modern tools and resources to help you build experiences that people love, faster and easier, across every Android device.

Jose Alcérreca
Jose Alcérreca

Written by Jose Alcérreca

Developer Relations Engineer @ Google, working on Android

Responses (3)