Kotlin List
15 functions
listOflistOf(vararg elements)Returns a new read-only list of given elements.
mutableListOfmutableListOf(vararg elements)Returns a new MutableList with the given elements.
addlist.add(element) / list.add(index, element)Adds the specified element to the end of this list.
getlist.get(index) / list[index]Returns the element at the specified index.
removelist.remove(element) / list.removeAt(index)Removes an element or removes the element at a specified index.
sizelist.sizeReturns the size of the collection.
containslist.contains(element)Returns true if the string contains the specified other string.
isEmptylist.isEmpty()Returns true if the string is empty.
firstlist.first() / list.firstOrNull()Returns the first element.
lastlist.last() / list.lastOrNull()Returns the last element.
sortedBylist.sortedBy { selector }Returns a list of all elements sorted according to natural sort order of the selector.
reversedlist.reversed()Returns a list with elements in reversed order.
distinctlist.distinct()Returns a list containing only distinct elements.
subListlist.subList(from, to)Returns a view of the portion of this list between fromIndex and toIndex.
flattenlist.flatten()Returns a single list of all elements from all collections in the given collection.
