Languages
Kotlin
Null safety, collection transformations and concise data models.
Values
val name = "Ada"Create a read-only bindingvar count = 0Create a mutable bindingval nickname: String? = nullExplicitly permit nullnickname?.length ?: 0Safe call followed by an Elvis fallbackFunctions and models
fun add(a: Int, b: Int) = a + bDefine a function with inferred return typedata class User(val id: Int, val name: String)Generate value-style model helpersval newer = user.copy(name = "Lin")Copy a data class with one changed fieldval (id, name) = userDestructure a data classCollections
val names = listOf("Ada", "Lin")Create a read-only list interfaceval mutable = mutableListOf<String>()Create a mutable listnames.filter { it.startsWith("A") }Select matching elementsnames.map { it.uppercase() }Transform each element