Kotlin Standard Functions cheat-sheet

Jose Alcérreca
Android Developers
Published in
1 min readJan 16, 2019

--

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.

--

--

Jose Alcérreca
Android Developers

Developer Relations Engineer @ Google, working on Android