-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Expand file tree
/
Copy path_UCollections.kt
More file actions
128 lines (115 loc) · 3.03 KB
/
Copy path_UCollections.kt
File metadata and controls
128 lines (115 loc) · 3.03 KB
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
/*
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("UCollectionsKt")
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.contracts.*
import kotlin.random.*
import kotlin.ranges.contains
import kotlin.ranges.reversed
/**
* Returns an array of UByte containing all of the elements of this collection.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public fun Collection<UByte>.toUByteArray(): UByteArray {
val result = UByteArray(size)
var index = 0
for (element in this)
result[index++] = element
return result
}
/**
* Returns an array of UInt containing all of the elements of this collection.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public fun Collection<UInt>.toUIntArray(): UIntArray {
val result = UIntArray(size)
var index = 0
for (element in this)
result[index++] = element
return result
}
/**
* Returns an array of ULong containing all of the elements of this collection.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public fun Collection<ULong>.toULongArray(): ULongArray {
val result = ULongArray(size)
var index = 0
for (element in this)
result[index++] = element
return result
}
/**
* Returns an array of UShort containing all of the elements of this collection.
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public fun Collection<UShort>.toUShortArray(): UShortArray {
val result = UShortArray(size)
var index = 0
for (element in this)
result[index++] = element
return result
}
/**
* Returns the sum of all elements in the collection.
*/
@kotlin.jvm.JvmName("sumOfUInt")
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Iterable<UInt>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the collection.
*/
@kotlin.jvm.JvmName("sumOfULong")
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Iterable<ULong>.sum(): ULong {
var sum: ULong = 0uL
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the collection.
*/
@kotlin.jvm.JvmName("sumOfUByte")
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Iterable<UByte>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {
sum += element
}
return sum
}
/**
* Returns the sum of all elements in the collection.
*/
@kotlin.jvm.JvmName("sumOfUShort")
@SinceKotlin("1.5")
@WasExperimental(ExperimentalUnsignedTypes::class)
public fun Iterable<UShort>.sum(): UInt {
var sum: UInt = 0u
for (element in this) {
sum += element
}
return sum
}