What do you want to save?
Add Code snippet
New code examples in category Kotlin
-
Jlars62 2021-11-14 08:51:13
calling kotlin from java
// Kotlin class KotlinClass { val fixed: String = "base.KotlinClass" var mutable: Boolean = false } // Java KotlinClass kotlinClass = new KotlinClass(); String s = kotlinClass.getFixed(); // Uses getter of ‘val’ kotlinClass.... Add solution -
Kathrin 2021-11-13 13:13:24
kotlin coroutine builders
import kotlinx.coroutines.* // Asynchronous execution fun main() { GlobalScope.launch { // creates a new coroutine and continues doWorld() // suspending function } println("World !") // execution continues even while coroutine wait... Add solution -
Robin G Brown 2021-11-12 00:34:08
create a map from list kotlin
fun main() { val numbers = listOf("one", "two", "three", "four") println(numbers.associateBy { it.first().toUpperCase() }) println(numbers.associateBy(keySelector = { it.first().toUpperCase() }, valueTr... Add solution -
-
Chris M 2021-11-10 06:26:09
kotlin coroutine dispatcher
Dispatchers.Default - Different thread (if possible) It is backed by a shared pool of threads on JVM. Dispatchers.Main - Platform specific main thread (if exists). Dispatchers.IO - Thread designed for offloading blocking IO tasks to a shared pool of threa... Add solution