SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

KOTLIN / NOTES</>↗
Kotlin24 Jun 2026

How do I use associateBy, partition, and zip in Kotlin?

In Kotlin, associateBy, partition, and zip are collection operations that help transform or split collections. associateBy associateBy creates a Map from a collection by choosing a key for each element. data class User(val id: Int, val name: String) val users = listOf( User(1, "Alice"), User(2, "Bob"), User(3, "Charlie") ) val usersById = users.associateBy { user […]

Wayan · 3 min read
KOTLIN / NOTES</>↗
Kotlin24 Jun 2026

How do I group and count elements using groupBy and count in Kotlin?

In Kotlin, you can group elements with groupBy, then count how many items are in each group. Basic example val words = listOf("apple", "banana", "apricot", "blueberry", "avocado") val countsByFirstLetter = words .groupBy { it.first() } .mapValues { (_, words) -> words.count() } println(countsByFirstLetter) Output: {a=3, b=2} Here: groupBy { it.first() } groups words by their […]

Wayan · 1 min read
KOTLIN / NOTES</>↗
Kotlin24 Jun 2026

How do I transform nested collections using flatMap in Kotlin?

In Kotlin, flatMap is used to transform each element into a collection and then flatten the results into a single list. Basic idea val result = items.flatMap { item -> // return a collection for each item } It is similar to: items.map { … }.flatten() but more concise. Example: flatten nested lists val nested […]

Wayan · 2 min read
KOTLIN / NOTES</>↗
Kotlin24 Jun 2026

How do I use map, filter and foreach with Kotlin collections?

In Kotlin collections: map transforms each element into a new value. filter keeps only elements that match a condition. forEach performs an action for each element. map: transform elements Use map when you want to create a new collection by changing each item. val numbers = listOf(1, 2, 3, 4) val doubled = numbers.map { […]

Wayan · 2 min read
KOTLIN / NOTES</>↗
Kotlin23 Jun 2026

How do I convert arrays to lists and vice versa in Kotlin?

In Kotlin, you can convert arrays to lists and lists to arrays using standard library functions. Array to List Use toList(): val array = arrayOf("a", "b", "c") val list: List<String> = array.toList() println(list) // [a, b, c] If you want a mutable list, use toMutableList(): val array = arrayOf("a", "b", "c") val mutableList: MutableList<String> = […]

Wayan · 2 min read
KOTLIN / NOTES</>↗
Kotlin23 Jun 2026

How do I sort a list of values in Kotlin?

In Kotlin, you usually sort a list with sorted(): val numbers = listOf(5, 2, 8, 1) val sortedNumbers = numbers.sorted() println(sortedNumbers) // [1, 2, 5, 8] sorted() returns a new sorted list and does not change the original list. For descending order, use sortedDescending(): val numbers = listOf(5, 2, 8, 1) val sortedDescending = numbers.sortedDescending() […]

Wayan · 1 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.