1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
/*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package kotlin.collections
//
// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
//
import kotlin.js.*
/**
* 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
public actual fun UIntArray.elementAt(index: Int): UInt {
return elementAtOrElse(index) { throw IndexOutOfBoundsException("index: $index, size: $size}") }
}
/**
* 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
public actual fun ULongArray.elementAt(index: Int): ULong {
return elementAtOrElse(index) { throw IndexOutOfBoundsException("index: $index, size: $size}") }
}
/**
* 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
public actual fun UByteArray.elementAt(index: Int): UByte {
return elementAtOrElse(index) { throw IndexOutOfBoundsException("index: $index, size: $size}") }
}
/**
* 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
public actual fun UShortArray.elementAt(index: Int): UShort {
return elementAtOrElse(index) { throw IndexOutOfBoundsException("index: $index, size: $size}") }
}
/**
* Returns a [List] that wraps the original array.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public actual fun UIntArray.asList(): List<UInt> {
return object : AbstractList<UInt>(), RandomAccess {
override val size: Int get() = this@asList.size
override fun isEmpty(): Boolean = this@asList.isEmpty()
override fun contains(element: UInt): Boolean = this@asList.contains(element)
override fun get(index: Int): UInt {
AbstractList.checkElementIndex(index, size)
return this@asList[index]
}
override fun indexOf(element: UInt): Int {
if ((element as Any?) !is UInt) return -1
return this@asList.indexOf(element)
}
override fun lastIndexOf(element: UInt): Int {
if ((element as Any?) !is UInt) return -1
return this@asList.lastIndexOf(element)
}
}
}
/**
* Returns a [List] that wraps the original array.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public actual fun ULongArray.asList(): List<ULong> {
return object : AbstractList<ULong>(), RandomAccess {
override val size: Int get() = this@asList.size
override fun isEmpty(): Boolean = this@asList.isEmpty()
override fun contains(element: ULong): Boolean = this@asList.contains(element)
override fun get(index: Int): ULong {
AbstractList.checkElementIndex(index, size)
return this@asList[index]
}
override fun indexOf(element: ULong): Int {
if ((element as Any?) !is ULong) return -1
return this@asList.indexOf(element)
}
override fun lastIndexOf(element: ULong): Int {
if ((element as Any?) !is ULong) return -1
return this@asList.lastIndexOf(element)
}
}
}
/**
* Returns a [List] that wraps the original array.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public actual fun UByteArray.asList(): List<UByte> {
return object : AbstractList<UByte>(), RandomAccess {
override val size: Int get() = this@asList.size
override fun isEmpty(): Boolean = this@asList.isEmpty()
override fun contains(element: UByte): Boolean = this@asList.contains(element)
override fun get(index: Int): UByte {
AbstractList.checkElementIndex(index, size)
return this@asList[index]
}
override fun indexOf(element: UByte): Int {
if ((element as Any?) !is UByte) return -1
return this@asList.indexOf(element)
}
override fun lastIndexOf(element: UByte): Int {
if ((element as Any?) !is UByte) return -1
return this@asList.lastIndexOf(element)
}
}
}
/**
* Returns a [List] that wraps the original array.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public actual fun UShortArray.asList(): List<UShort> {
return object : AbstractList<UShort>(), RandomAccess {
override val size: Int get() = this@asList.size
override fun isEmpty(): Boolean = this@asList.isEmpty()
override fun contains(element: UShort): Boolean = this@asList.contains(element)
override fun get(index: Int): UShort {
AbstractList.checkElementIndex(index, size)
return this@asList[index]
}
override fun indexOf(element: UShort): Int {
if ((element as Any?) !is UShort) return -1
return this@asList.indexOf(element)
}
override fun lastIndexOf(element: UShort): Int {
if ((element as Any?) !is UShort) return -1
return this@asList.lastIndexOf(element)
}
}
}
|