Promote ArrayDeque and MutableList.removeFirst/LastOrNull to stable
This commit is contained in:
@@ -13,8 +13,8 @@ package kotlin.collections
|
||||
* The collection provide methods for convenient access to the both ends.
|
||||
* It also implements [MutableList] interface and supports efficient get/set operations by index.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public class ArrayDeque<E> : AbstractMutableList<E> {
|
||||
private var head: Int = 0
|
||||
private var elementData: Array<Any?>
|
||||
|
||||
@@ -236,29 +236,29 @@ public inline fun <T> MutableList<T>.remove(index: Int): T = removeAt(index)
|
||||
/**
|
||||
* Removes the first element from this mutable list and returns that removed element, or throws [NoSuchElementException] if this list is empty.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public fun <T> MutableList<T>.removeFirst(): T = if (isEmpty()) throw NoSuchElementException("List is empty.") else removeAt(0)
|
||||
|
||||
/**
|
||||
* Removes the first element from this mutable list and returns that removed element, or returns `null` if this list is empty.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public fun <T> MutableList<T>.removeFirstOrNull(): T? = if (isEmpty()) null else removeAt(0)
|
||||
|
||||
/**
|
||||
* Removes the last element from this mutable list and returns that removed element, or throws [NoSuchElementException] if this list is empty.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public fun <T> MutableList<T>.removeLast(): T = if (isEmpty()) throw NoSuchElementException("List is empty.") else removeAt(lastIndex)
|
||||
|
||||
/**
|
||||
* Removes the last element from this mutable list and returns that removed element, or returns `null` if this list is empty.
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalStdlibApi
|
||||
@SinceKotlin("1.4")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public fun <T> MutableList<T>.removeLastOrNull(): T? = if (isEmpty()) null else removeAt(lastIndex)
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user