Last updated 272 days ago by Jose Alcérrecakotlin
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:
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.