listOf

fun <T> listOf(element: T): List<T>(source)

Returns an immutable list containing only the specified object element. The returned list is serializable.

Since Kotlin

1.0

Samples



import kotlin.test.*
fun main() { 
   //sampleStart 
   val list = listOf('a')
println(list) // [a]
println(list.size) // 1 
   //sampleEnd
}