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</>↗
Kotlin23 Jun 2026

How do I check if a collection is empty or contains an element in Kotlin?

In Kotlin, use isEmpty() / isNotEmpty() to check whether a collection has elements, and use in, contains(), or map-specific methods to check contents. val names = listOf("Alice", "Bob") println(names.isEmpty()) // false println(names.isNotEmpty()) // true println("Alice" in names) // true println("Charlie" !in names) // true For lists and sets: val numbers = setOf(1, 2, 3) if […]

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

How do I access elements safely in Kotlin collections?

In Kotlin, you can access collection elements safely by using functions that return null instead of throwing exceptions when an index/key is missing. Lists / arrays: use getOrNull val items = listOf("A", "B", "C") val first = items.getOrNull(0) // "A" val missing = items.getOrNull(10) // null This is safer than: val missing = items[10] // […]

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

How do I create and use lists, sets, and maps in Kotlin?

In Kotlin, the main collection types are List, Set, and Map. Kotlin provides both read-only and mutable versions: Collection Read-only Mutable List List<T> MutableList<T> Set Set<T> MutableSet<T> Map Map<K, V> MutableMap<K, V> Lists A list is an ordered collection. It can contain duplicate elements. Read-only list val numbers = listOf(1, 2, 3, 3) println(numbers[0]) // […]

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

How do I implement the singleton pattern idiomatically using Kotlin’s object declaration?

In Kotlin, the idiomatic way to implement the Singleton pattern is to use an object declaration. object AppConfig { val appName = "MyApp" fun printConfig() { println("App name: $appName") } } You use it directly by its name: fun main() { AppConfig.printConfig() println(AppConfig.appName) } Kotlin guarantees that an object declaration: has exactly one instance is […]

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

How do I mix OOP with functional programming using Kotlin’s design patterns?

You can mix OOP and functional programming in Kotlin by using objects/classes to model state, identity, boundaries, and domain concepts, while using functions/lambdas to model behavior, transformation, policies, and workflows. Kotlin is especially good at this because it supports: Classes, interfaces, inheritance, encapsulation Data classes and sealed classes Lambdas and higher-order functions Immutability with val […]

Wayan · 8 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.