List is an data structure used to store collection of elements, Feature are elements in insertion order.
List is an interface that extends Collection interface. It is an Generic class for read only collection.
interface List<out E> : Collection<E>
Above is an Generic List of Type E. E is an Data type of an element.
List Types
There are two types of Lists in Kotlin language.
Immutable List These are read only access to collection of elements, Does not allow add or remove elements.
- listOf()
- emptyList()
- ListOfNotNull
Mutable List