Check for index-out-of-bound in elementAt function (KT-30051)
This commit is contained in:
@@ -15,6 +15,54 @@ package kotlin.collections
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
|
||||
*
|
||||
* @sample samples.collections.Collections.Elements.elementAt
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun UIntArray.elementAt(index: Int): UInt {
|
||||
return get(index)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
|
||||
*
|
||||
* @sample samples.collections.Collections.Elements.elementAt
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun ULongArray.elementAt(index: Int): ULong {
|
||||
return get(index)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
|
||||
*
|
||||
* @sample samples.collections.Collections.Elements.elementAt
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun UByteArray.elementAt(index: Int): UByte {
|
||||
return get(index)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
|
||||
*
|
||||
* @sample samples.collections.Collections.Elements.elementAt
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
@ExperimentalUnsignedTypes
|
||||
@kotlin.internal.InlineOnly
|
||||
public actual inline fun UShortArray.elementAt(index: Int): UShort {
|
||||
return get(index)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a [List] that wraps the original array.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user