Kotlin Everywhere: Versatility and Efficiency in Software Development
'Kotlin Everywhere: Versatility and Efficiency in Software Development' is a talk given at DevFest 2023 by GDG Makurdi. It shows the versatility and efficiency when using Kotlin to develop powerful software.
type inference developed by JetBrains. Kotlin interoperates fully with Java, and it can be used to write Android apps, IOS apps*, web applications, and other types of software. Makurdi
{ val list = ArrayList<Int>() // 'for'-loops work for Java collections: for (item in source) { list.add(item) } // Operator conventions work as well: for (i in 0..source.size - 1) { list[i] = source[i] // get and set are called } }
// A function that can be suspended and resumed later val start = System.currentTimeMillis() coroutineScope { // Create a scope for starting coroutines for (i in 1..10) { launch { // Start 10 concurrent tasks delay(3000L - i * 300) // Pause their execution log(start, "Countdown: $i") } } } // Execution continues when all coroutines in the scope have finished log(start, "Liftoff!") }
tmp = this[index1] // 'this' corresponds to the list this[index1] = this[index2] this[index2] = tmp } val list = mutableListOf(1, 2, 3) list.swap(0, 2) // 'this' inside 'swap()' will hold the value of 'list'