Kotlin and Immutable Collections?

Kotlin’s List from the standard library is readonly: interface List<out E> : Collection<E> (source) A generic ordered collection of elements. Methods in this interface support only read-only access to the list; read/write access is supported through the MutableList interface. Parameters E – the type of elements contained in the list. As mentioned, there is also … Read more

Single exclamation mark in Kotlin

They’re called platform types and they mean that Kotlin doesn’t know whether that value can or cannot be null and it’s up to you to decide if it’s nullable or not. In a nutshell, the problem is that any reference coming from Java may be null, and Kotlin, being null-safe by design, forced the user … Read more

What is a “receiver” in Kotlin?

It is true that there appears to be little existing documentation for the concept of receivers (only a small side note related to extension functions), which is surprising given: their existence springing out of extension functions; their role in building a DSL using said extension functions; the existence of a standard library function with, which … Read more

How to make clickable listview in android using kotlin

It’s really not much different from how you’d do it in Java since Kotlin uses Java’s frameworks/libraries and its JVM. Just apply the necessary Kotlin plugins and configurations in Android Studio, convert the Java code to Kotlin, and then refer to the Kotlin docs for potential bug fixes and whatnot.