As Kotlin documentation says listOf<T> has three implementations: for no arguments, one argument and varargs. Each function should return immutable List<T>.
val emptyList = listOf<String>()
val oneArgList = listOf("asd")
val varargsList = listOf("asd", "asd")
if (emptyList is MutableList) println("emptyList is mutable")
if (oneArgList is MutableList) println("oneArgList is mutable")
if (varargsList is MutableList) println("varargList is mutable")
Execution of code above results in
oneArgList is mutable
varargList is mutable
Why it works that way? Is this desired behaviour?