Kotlin Standard Functions cheat-sheet

Jose Alcérreca
Jan 16, 2019 · 1 min read

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.

Image for post
Image for post
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.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

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