Document Array and String get() function behavior (KT-30141)
This commit is contained in:
@@ -17,10 +17,20 @@ internal constructor(@PublishedApi internal val storage: ByteArray) : Collection
|
||||
/** Creates a new array of the specified [size], with all elements initialized to zero. */
|
||||
public constructor(size: Int) : this(ByteArray(size))
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): UByte = storage[index].toUByte()
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: UByte) {
|
||||
storage[index] = value.toByte()
|
||||
}
|
||||
|
||||
@@ -17,10 +17,20 @@ internal constructor(@PublishedApi internal val storage: IntArray) : Collection<
|
||||
/** Creates a new array of the specified [size], with all elements initialized to zero. */
|
||||
public constructor(size: Int) : this(IntArray(size))
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): UInt = storage[index].toUInt()
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: UInt) {
|
||||
storage[index] = value.toInt()
|
||||
}
|
||||
|
||||
@@ -17,10 +17,20 @@ internal constructor(@PublishedApi internal val storage: LongArray) : Collection
|
||||
/** Creates a new array of the specified [size], with all elements initialized to zero. */
|
||||
public constructor(size: Int) : this(LongArray(size))
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): ULong = storage[index].toULong()
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: ULong) {
|
||||
storage[index] = value.toLong()
|
||||
}
|
||||
|
||||
@@ -17,10 +17,20 @@ internal constructor(@PublishedApi internal val storage: ShortArray) : Collectio
|
||||
/** Creates a new array of the specified [size], with all elements initialized to zero. */
|
||||
public constructor(size: Int) : this(ShortArray(size))
|
||||
|
||||
/** Returns the array element at the given [index]. This method can be called using the index operator. */
|
||||
/**
|
||||
* Returns the array element at the given [index]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun get(index: Int): UShort = storage[index].toUShort()
|
||||
|
||||
/** Sets the element at the given [index] to the given [value]. This method can be called using the index operator. */
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
*
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException] except in Kotlin/JS
|
||||
* where the behavior is unspecified.
|
||||
*/
|
||||
public operator fun set(index: Int, value: UShort) {
|
||||
storage[index] = value.toShort()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user