Introduce annotation InlineExposed to indicate internal members effectively public due to usage in inlined functions.
Currently, doesn't affect anything. Make collectionSizeOrDefault and collectionSizeOrNull internal, but expose them via inlining together with mapCapacity. Make Regex(Pattern) constructor exposed by inlined Pattern.toRegex
This commit is contained in:
@@ -5491,7 +5491,8 @@ public fun Array<out Short>.toShortArray(): ShortArray {
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K, V> Array<out T>.associate(transform: (T) -> Pair<K, V>): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
}
|
||||
|
||||
@@ -5501,7 +5502,8 @@ public inline fun <T, K, V> Array<out T>.associate(transform: (T) -> Pair<K, V>)
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> BooleanArray.associate(transform: (Boolean) -> Pair<K, V>): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
}
|
||||
|
||||
@@ -5511,7 +5513,8 @@ public inline fun <K, V> BooleanArray.associate(transform: (Boolean) -> Pair<K,
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> ByteArray.associate(transform: (Byte) -> Pair<K, V>): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
}
|
||||
|
||||
@@ -5521,7 +5524,8 @@ public inline fun <K, V> ByteArray.associate(transform: (Byte) -> Pair<K, V>): M
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> CharArray.associate(transform: (Char) -> Pair<K, V>): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
}
|
||||
|
||||
@@ -5531,7 +5535,8 @@ public inline fun <K, V> CharArray.associate(transform: (Char) -> Pair<K, V>): M
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> DoubleArray.associate(transform: (Double) -> Pair<K, V>): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
}
|
||||
|
||||
@@ -5541,7 +5546,8 @@ public inline fun <K, V> DoubleArray.associate(transform: (Double) -> Pair<K, V>
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> FloatArray.associate(transform: (Float) -> Pair<K, V>): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
}
|
||||
|
||||
@@ -5551,7 +5557,8 @@ public inline fun <K, V> FloatArray.associate(transform: (Float) -> Pair<K, V>):
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> IntArray.associate(transform: (Int) -> Pair<K, V>): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
}
|
||||
|
||||
@@ -5561,7 +5568,8 @@ public inline fun <K, V> IntArray.associate(transform: (Int) -> Pair<K, V>): Map
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> LongArray.associate(transform: (Long) -> Pair<K, V>): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
}
|
||||
|
||||
@@ -5571,7 +5579,8 @@ public inline fun <K, V> LongArray.associate(transform: (Long) -> Pair<K, V>): M
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> ShortArray.associate(transform: (Short) -> Pair<K, V>): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
}
|
||||
|
||||
@@ -5581,7 +5590,8 @@ public inline fun <K, V> ShortArray.associate(transform: (Short) -> Pair<K, V>):
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K> Array<out T>.associateBy(keySelector: (T) -> K): Map<K, T> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, T>(capacity), keySelector)
|
||||
}
|
||||
|
||||
@@ -5591,7 +5601,8 @@ public inline fun <T, K> Array<out T>.associateBy(keySelector: (T) -> K): Map<K,
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K> BooleanArray.associateBy(keySelector: (Boolean) -> K): Map<K, Boolean> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, Boolean>(capacity), keySelector)
|
||||
}
|
||||
|
||||
@@ -5601,7 +5612,8 @@ public inline fun <K> BooleanArray.associateBy(keySelector: (Boolean) -> K): Map
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K> ByteArray.associateBy(keySelector: (Byte) -> K): Map<K, Byte> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, Byte>(capacity), keySelector)
|
||||
}
|
||||
|
||||
@@ -5611,7 +5623,8 @@ public inline fun <K> ByteArray.associateBy(keySelector: (Byte) -> K): Map<K, By
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K> CharArray.associateBy(keySelector: (Char) -> K): Map<K, Char> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, Char>(capacity), keySelector)
|
||||
}
|
||||
|
||||
@@ -5621,7 +5634,8 @@ public inline fun <K> CharArray.associateBy(keySelector: (Char) -> K): Map<K, Ch
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K> DoubleArray.associateBy(keySelector: (Double) -> K): Map<K, Double> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, Double>(capacity), keySelector)
|
||||
}
|
||||
|
||||
@@ -5631,7 +5645,8 @@ public inline fun <K> DoubleArray.associateBy(keySelector: (Double) -> K): Map<K
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K> FloatArray.associateBy(keySelector: (Float) -> K): Map<K, Float> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, Float>(capacity), keySelector)
|
||||
}
|
||||
|
||||
@@ -5641,7 +5656,8 @@ public inline fun <K> FloatArray.associateBy(keySelector: (Float) -> K): Map<K,
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K> IntArray.associateBy(keySelector: (Int) -> K): Map<K, Int> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, Int>(capacity), keySelector)
|
||||
}
|
||||
|
||||
@@ -5651,7 +5667,8 @@ public inline fun <K> IntArray.associateBy(keySelector: (Int) -> K): Map<K, Int>
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K> LongArray.associateBy(keySelector: (Long) -> K): Map<K, Long> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, Long>(capacity), keySelector)
|
||||
}
|
||||
|
||||
@@ -5661,7 +5678,8 @@ public inline fun <K> LongArray.associateBy(keySelector: (Long) -> K): Map<K, Lo
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K> ShortArray.associateBy(keySelector: (Short) -> K): Map<K, Short> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, Short>(capacity), keySelector)
|
||||
}
|
||||
|
||||
@@ -5670,7 +5688,8 @@ public inline fun <K> ShortArray.associateBy(keySelector: (Short) -> K): Map<K,
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K, V> Array<out T>.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
}
|
||||
|
||||
@@ -5679,7 +5698,8 @@ public inline fun <T, K, V> Array<out T>.associateBy(keySelector: (T) -> K, valu
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> BooleanArray.associateBy(keySelector: (Boolean) -> K, valueTransform: (Boolean) -> V): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
}
|
||||
|
||||
@@ -5688,7 +5708,8 @@ public inline fun <K, V> BooleanArray.associateBy(keySelector: (Boolean) -> K, v
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> ByteArray.associateBy(keySelector: (Byte) -> K, valueTransform: (Byte) -> V): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
}
|
||||
|
||||
@@ -5697,7 +5718,8 @@ public inline fun <K, V> ByteArray.associateBy(keySelector: (Byte) -> K, valueTr
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> CharArray.associateBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
}
|
||||
|
||||
@@ -5706,7 +5728,8 @@ public inline fun <K, V> CharArray.associateBy(keySelector: (Char) -> K, valueTr
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> DoubleArray.associateBy(keySelector: (Double) -> K, valueTransform: (Double) -> V): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
}
|
||||
|
||||
@@ -5715,7 +5738,8 @@ public inline fun <K, V> DoubleArray.associateBy(keySelector: (Double) -> K, val
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> FloatArray.associateBy(keySelector: (Float) -> K, valueTransform: (Float) -> V): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
}
|
||||
|
||||
@@ -5724,7 +5748,8 @@ public inline fun <K, V> FloatArray.associateBy(keySelector: (Float) -> K, value
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> IntArray.associateBy(keySelector: (Int) -> K, valueTransform: (Int) -> V): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
}
|
||||
|
||||
@@ -5733,7 +5758,8 @@ public inline fun <K, V> IntArray.associateBy(keySelector: (Int) -> K, valueTran
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> LongArray.associateBy(keySelector: (Long) -> K, valueTransform: (Long) -> V): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
}
|
||||
|
||||
@@ -5742,7 +5768,8 @@ public inline fun <K, V> LongArray.associateBy(keySelector: (Long) -> K, valueTr
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> ShortArray.associateBy(keySelector: (Short) -> K, valueTransform: (Short) -> V): Map<K, V> {
|
||||
val capacity = ((size/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(size).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
}
|
||||
|
||||
@@ -11356,6 +11383,7 @@ public infix fun <R> ShortArray.zip(other: Iterable<R>): List<Pair<Short, R>> {
|
||||
*/
|
||||
public inline fun <T, R, V> Array<out T>.zip(other: Iterable<R>, transform: (T, R) -> V): List<V> {
|
||||
val arraySize = size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in other) {
|
||||
@@ -11370,6 +11398,7 @@ public inline fun <T, R, V> Array<out T>.zip(other: Iterable<R>, transform: (T,
|
||||
*/
|
||||
public inline fun <R, V> BooleanArray.zip(other: Iterable<R>, transform: (Boolean, R) -> V): List<V> {
|
||||
val arraySize = size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in other) {
|
||||
@@ -11384,6 +11413,7 @@ public inline fun <R, V> BooleanArray.zip(other: Iterable<R>, transform: (Boolea
|
||||
*/
|
||||
public inline fun <R, V> ByteArray.zip(other: Iterable<R>, transform: (Byte, R) -> V): List<V> {
|
||||
val arraySize = size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in other) {
|
||||
@@ -11398,6 +11428,7 @@ public inline fun <R, V> ByteArray.zip(other: Iterable<R>, transform: (Byte, R)
|
||||
*/
|
||||
public inline fun <R, V> CharArray.zip(other: Iterable<R>, transform: (Char, R) -> V): List<V> {
|
||||
val arraySize = size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in other) {
|
||||
@@ -11412,6 +11443,7 @@ public inline fun <R, V> CharArray.zip(other: Iterable<R>, transform: (Char, R)
|
||||
*/
|
||||
public inline fun <R, V> DoubleArray.zip(other: Iterable<R>, transform: (Double, R) -> V): List<V> {
|
||||
val arraySize = size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in other) {
|
||||
@@ -11426,6 +11458,7 @@ public inline fun <R, V> DoubleArray.zip(other: Iterable<R>, transform: (Double,
|
||||
*/
|
||||
public inline fun <R, V> FloatArray.zip(other: Iterable<R>, transform: (Float, R) -> V): List<V> {
|
||||
val arraySize = size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in other) {
|
||||
@@ -11440,6 +11473,7 @@ public inline fun <R, V> FloatArray.zip(other: Iterable<R>, transform: (Float, R
|
||||
*/
|
||||
public inline fun <R, V> IntArray.zip(other: Iterable<R>, transform: (Int, R) -> V): List<V> {
|
||||
val arraySize = size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in other) {
|
||||
@@ -11454,6 +11488,7 @@ public inline fun <R, V> IntArray.zip(other: Iterable<R>, transform: (Int, R) ->
|
||||
*/
|
||||
public inline fun <R, V> LongArray.zip(other: Iterable<R>, transform: (Long, R) -> V): List<V> {
|
||||
val arraySize = size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in other) {
|
||||
@@ -11468,6 +11503,7 @@ public inline fun <R, V> LongArray.zip(other: Iterable<R>, transform: (Long, R)
|
||||
*/
|
||||
public inline fun <R, V> ShortArray.zip(other: Iterable<R>, transform: (Short, R) -> V): List<V> {
|
||||
val arraySize = size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in other) {
|
||||
|
||||
@@ -926,7 +926,8 @@ public fun Collection<Short>.toShortArray(): ShortArray {
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K, V> Iterable<T>.associate(transform: (T) -> Pair<K, V>): Map<K, V> {
|
||||
val capacity = ((collectionSizeOrDefault(10)/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
}
|
||||
|
||||
@@ -936,7 +937,8 @@ public inline fun <T, K, V> Iterable<T>.associate(transform: (T) -> Pair<K, V>):
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K> Iterable<T>.associateBy(keySelector: (T) -> K): Map<K, T> {
|
||||
val capacity = ((collectionSizeOrDefault(10)/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, T>(capacity), keySelector)
|
||||
}
|
||||
|
||||
@@ -945,7 +947,8 @@ public inline fun <T, K> Iterable<T>.associateBy(keySelector: (T) -> K): Map<K,
|
||||
* If any two elements would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <T, K, V> Iterable<T>.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, V> {
|
||||
val capacity = ((collectionSizeOrDefault(10)/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
}
|
||||
|
||||
@@ -1165,6 +1168,7 @@ public inline fun <T, K, V, M : MutableMap<in K, MutableList<V>>> Iterable<T>.gr
|
||||
* Returns a list containing the results of applying the given [transform] function
|
||||
* to each element in the original collection.
|
||||
*/
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
public inline fun <T, R> Iterable<T>.map(transform: (T) -> R): List<R> {
|
||||
return mapTo(ArrayList<R>(collectionSizeOrDefault(10)), transform)
|
||||
}
|
||||
@@ -1173,6 +1177,7 @@ public inline fun <T, R> Iterable<T>.map(transform: (T) -> R): List<R> {
|
||||
* Returns a list containing the results of applying the given [transform] function
|
||||
* to each element and its index in the original collection.
|
||||
*/
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
public inline fun <T, R> Iterable<T>.mapIndexed(transform: (Int, T) -> R): List<R> {
|
||||
return mapIndexedTo(ArrayList<R>(collectionSizeOrDefault(10)), transform)
|
||||
}
|
||||
@@ -1805,6 +1810,7 @@ public infix fun <T, R> Iterable<T>.zip(other: Array<out R>): List<Pair<T, R>> {
|
||||
*/
|
||||
public inline fun <T, R, V> Iterable<T>.zip(other: Array<out R>, transform: (T, R) -> V): List<V> {
|
||||
val arraySize = other.size
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(collectionSizeOrDefault(10), arraySize))
|
||||
var i = 0
|
||||
for (element in this) {
|
||||
@@ -1827,6 +1833,7 @@ public infix fun <T, R> Iterable<T>.zip(other: Iterable<R>): List<Pair<T, R>> {
|
||||
public inline fun <T, R, V> Iterable<T>.zip(other: Iterable<R>, transform: (T, R) -> V): List<V> {
|
||||
val first = iterator()
|
||||
val second = other.iterator()
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val list = ArrayList<V>(Math.min(collectionSizeOrDefault(10), other.collectionSizeOrDefault(10)))
|
||||
while (first.hasNext() && second.hasNext()) {
|
||||
list.add(transform(first.next(), second.next()))
|
||||
|
||||
@@ -499,7 +499,8 @@ public inline fun String.reversed(): String {
|
||||
* If any of two pairs would have the same key the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> CharSequence.associate(transform: (Char) -> Pair<K, V>): Map<K, V> {
|
||||
val capacity = ((length/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(length).coerceAtLeast(16)
|
||||
return associateTo(LinkedHashMap<K, V>(capacity), transform)
|
||||
}
|
||||
|
||||
@@ -509,7 +510,8 @@ public inline fun <K, V> CharSequence.associate(transform: (Char) -> Pair<K, V>)
|
||||
* If any two characters would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K> CharSequence.associateBy(keySelector: (Char) -> K): Map<K, Char> {
|
||||
val capacity = ((length/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(length).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, Char>(capacity), keySelector)
|
||||
}
|
||||
|
||||
@@ -518,7 +520,8 @@ public inline fun <K> CharSequence.associateBy(keySelector: (Char) -> K): Map<K,
|
||||
* If any two characters would have the same key returned by [keySelector] the last one gets added to the map.
|
||||
*/
|
||||
public inline fun <K, V> CharSequence.associateBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map<K, V> {
|
||||
val capacity = ((length/.75f) + 1).toInt().coerceAtLeast(16)
|
||||
@Suppress("INVISIBLE_MEMBER_FROM_INLINE")
|
||||
val capacity = mapCapacity(length).coerceAtLeast(16)
|
||||
return associateByTo(LinkedHashMap<K, V>(capacity), keySelector, valueTransform)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user