List is one of the most commonly used collection data types. It is an implementation of the Collection interface used to work with a group of ordered data.
As we mentioned earlier, Kotlin distinguishes between mutable and read-only collection types; so, the List interface, which is immutable, contains only the read-only functions, as follows:
- fun get(index: Int):E: This method is used to get an element from the list at the given index.
- fun indexOf(element: @UnsafeVariance E):Int: This method is used ...