Kotlin リスト
15個の関数
listOflistOf(vararg elements)不変リストを生成します。
mutableListOfmutableListOf(vararg elements)変更可能なリストを生成します。
addlist.add(element) / list.add(index, element)リストに要素を追加します。
getlist.get(index) / list[index]指定したインデックスの要素を返します。
removelist.remove(element) / list.removeAt(index)要素またはインデックスの要素を削除します。
sizelist.sizeコレクションのサイズを返します。
containslist.contains(element)指定した文字列を含むか確認します。
isEmptylist.isEmpty()文字列が空かどうか確認します。
firstlist.first() / list.firstOrNull()最初の要素を返します。
lastlist.last() / list.lastOrNull()最後の要素を返します。
sortedBylist.sortedBy { selector }セレクタの自然順序で並べ替えた新しいリストを返します。
reversedlist.reversed()逆順に並べ替えた新しいリストを返します。
distinctlist.distinct()重複を除いた新しいリストを返します。
subListlist.subList(from, to)部分リストを返します。
flattenlist.flatten()ネストされたコレクションを平坦化します。
