Ruang penulis
SEBUAH JURNAL TENTANG TEKNOLOGI

Belajar hal baru.
Tulis. Bagikan.

Ruang untuk merangkai pengetahuan, satu baris kode setiap hari.
Temukan tutorial, ide, dan catatan dari perjalanan belajar.

1914 catatan & terus bertumbuh
PILIHAN EDITOR
Java

Memahami Java Stream: olah koleksi dengan lebih ringkas

Pelajari alur filter, map, dan collect untuk mengolah data Java dengan kode yang mudah dibaca.

D Tim Diary Coding · 1 menit baca
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

KOTLIN / CATATAN</>
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 menit baca
KOTLIN / CATATAN</>
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 menit baca
KOTLIN / CATATAN</>
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 menit baca
KOTLIN / CATATAN</>
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 menit baca
KOTLIN / CATATAN</>
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 menit baca

Pengetahuan tumbuh ketika dibagikan.

Simpan rasa ingin tahu. Selalu ada hal baru untuk dipelajari.

Jelajahi catatan ↗
Putu Adi Guna Permana
TENTANG PENULIS

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

Penulis dan pendiri Diary Coding — berbagi catatan, tutorial, dan pengalaman seputar pemrograman untuk siapa pun yang ingin terus belajar.