listOf

external fun <T> listOf(vararg elements: T): List<T>(source)

Creates a new list containing elements in argument order, including duplicates and nulls.

The result uses ArrayList storage exposed through List. Read-only access does not make the underlying object immutable. Elements are retained as values or references, not cloned. Guest Kotlin supports direct vararg arguments; spread arguments remain unavailable.

Return

a fresh list, empty when no elements are supplied.

Parameters

elements

elements to place in the list.

Type Parameters

T

element type.

See also