Learning Kotlin Programming

Kotlin Collection Functions Cheat Sheet

Enable learning and finding relevant collection function easier

--

Kotlin provides a rich utility set of functions for its collections. There are about 200 of them. To use them, one needs to know that they exist. It is hard to scan through 200 of them alphabetically to find which is relevant. Hence I’m making a cheat sheet for the functions, grouping them based on its functionality. Hopefully making learning and finding what you want easier.

I’m grouping them into 5 categories as below.

  1. Creation — Functions that create a collection, e.g. listOf
  2. Convert — Functions that cast to the other type, e.g. asMap
  3. Change — Functions that transform the contents, e.g. map
  4. Choose — Functions that access one of the items e.g. get
  5. Conclude — Functions that generate something from the items, e.g. sum

In the document, for some of the functions that are not easily understood, I’ll provide some illustration, while the others that are named clearer, I provide a link to their respective formal documentation.

Check through them once to get your familiarity with the sections, and in the…

--

--