A list is a data structure used to store a collection of elements, Features are elements in insertion order.

The list is an interface that extends the Collection interface. It is a Generic class for read-only collection.

interface List<out E> : Collection<E>

Above is a Generic List of Type E. E is a Data type of an element.

List Types

There are two types of Lists in Kotlin language.

  • Immutable List These are read-only access to a collection of elements and Do not allow add or remove elements.

    • listOf()
    • emptyList()
    • ListOfNotNull
  • Mutable List