Kotlin has both mutable and immutable collections. Having implicit control over whether collections can be edited is useful for writing clear and reliable code. It's important to understand that immutable collections in Kotlin are simply read-only, as the JVM doesn't see a difference between an immutable and mutable collection.
Let's look at the simplified version of the Collections.kt file:
public fun <T> emptyList(): List<T> = EmptyList
public fun <T> listOf(vararg elements: T): List<T> = if (elements.size > 0) elements.asList() else emptyList()
public inline fun <T> listOf(): List<T> = emptyList()
public fun <T> listOf(element: T): List<T> = java.util.Collections.singletonList(element)
public inline fun <T> mutableListOf(): MutableList<T> = ArrayList()
public inline fun <T>...