Document Array and String get() function behavior (KT-30141)

This commit is contained in:
Abduqodiri Qurbonzoda
2019-03-12 19:57:15 +03:00
parent a4c693ec29
commit 814d6cf39c
10 changed files with 196 additions and 30 deletions
@@ -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()
}