remove At
Платформы и требования к версиям: Common (1.0), JS (1.1), Native (1.3), Wasm-JS (1.8), Wasm-WASI (1.8)
expect open override fun removeAt(index: Int): E
Удаляет из списка элемент с указанным индексом.
Все элементы, расположенные после индекса, сдвигаются на одну позицию влево.
Возвращаемое значение
удалённый элемент.
Исключения
Примеры
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val list = mutableListOf('a', 'b', 'c')
list.removeAt(1)
println(list) // [a, c]
list.removeAt(0)
println(list) // [c]
// list.removeAt(1) // will fail with IndexOutOfBoundsException
//sampleEnd
}
© 2010–2026 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-array-list/remove-at.html