|
|
|
@@ -8942,334 +8942,134 @@ public fun <T : Any> Array<out T?>.requireNoNulls(): Array<out T> {
|
|
|
|
|
return this as Array<out T>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <T, R, V> Array<out T>.merge(array: Array<out R>, transform: (T, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <R, V> BooleanArray.merge(array: Array<out R>, transform: (Boolean, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <R, V> ByteArray.merge(array: Array<out R>, transform: (Byte, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <R, V> CharArray.merge(array: Array<out R>, transform: (Char, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <R, V> DoubleArray.merge(array: Array<out R>, transform: (Double, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <R, V> FloatArray.merge(array: Array<out R>, transform: (Float, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <R, V> IntArray.merge(array: Array<out R>, transform: (Int, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <R, V> LongArray.merge(array: Array<out R>, transform: (Long, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <R, V> ShortArray.merge(array: Array<out R>, transform: (Short, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <V> BooleanArray.merge(array: BooleanArray, transform: (Boolean, Boolean) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <V> ByteArray.merge(array: ByteArray, transform: (Byte, Byte) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <V> CharArray.merge(array: CharArray, transform: (Char, Char) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <V> DoubleArray.merge(array: DoubleArray, transform: (Double, Double) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <V> FloatArray.merge(array: FloatArray, transform: (Float, Float) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <V> IntArray.merge(array: IntArray, transform: (Int, Int) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <V> LongArray.merge(array: LongArray, transform: (Long, Long) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(array, transform)"))
|
|
|
|
|
public inline fun <V> ShortArray.merge(array: ShortArray, transform: (Short, Short) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(array, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(other, transform)"))
|
|
|
|
|
public inline fun <T, R, V> Array<out T>.merge(other: Iterable<R>, transform: (T, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(other, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(other, transform)"))
|
|
|
|
|
public inline fun <R, V> BooleanArray.merge(other: Iterable<R>, transform: (Boolean, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(other, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(other, transform)"))
|
|
|
|
|
public inline fun <R, V> ByteArray.merge(other: Iterable<R>, transform: (Byte, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(other, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(other, transform)"))
|
|
|
|
|
public inline fun <R, V> CharArray.merge(other: Iterable<R>, transform: (Char, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(other, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(other, transform)"))
|
|
|
|
|
public inline fun <R, V> DoubleArray.merge(other: Iterable<R>, transform: (Double, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(other, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(other, transform)"))
|
|
|
|
|
public inline fun <R, V> FloatArray.merge(other: Iterable<R>, transform: (Float, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(other, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(other, transform)"))
|
|
|
|
|
public inline fun <R, V> IntArray.merge(other: Iterable<R>, transform: (Int, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(other, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(other, transform)"))
|
|
|
|
|
public inline fun <R, V> LongArray.merge(other: Iterable<R>, transform: (Long, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(other, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated("Use zip() with transform instead.", ReplaceWith("zip(other, transform)"))
|
|
|
|
|
public inline fun <R, V> ShortArray.merge(other: Iterable<R>, transform: (Short, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
return zip(other, transform)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -9438,182 +9238,512 @@ public inline fun ShortArray.partition(predicate: (Short) -> Boolean): Pair<List
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <T, R> Array<out T>.zip(array: Array<out R>): List<Pair<T, R>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> BooleanArray.zip(array: Array<out R>): List<Pair<Boolean, R>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> ByteArray.zip(array: Array<out R>): List<Pair<Byte, R>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> CharArray.zip(array: Array<out R>): List<Pair<Char, R>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> DoubleArray.zip(array: Array<out R>): List<Pair<Double, R>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> FloatArray.zip(array: Array<out R>): List<Pair<Float, R>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> IntArray.zip(array: Array<out R>): List<Pair<Int, R>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> LongArray.zip(array: Array<out R>): List<Pair<Long, R>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> ShortArray.zip(array: Array<out R>): List<Pair<Short, R>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <T, R, V> Array<out T>.zip(array: Array<out R>, transform: (T, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> BooleanArray.zip(array: Array<out R>, transform: (Boolean, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> ByteArray.zip(array: Array<out R>, transform: (Byte, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> CharArray.zip(array: Array<out R>, transform: (Char, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> DoubleArray.zip(array: Array<out R>, transform: (Double, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> FloatArray.zip(array: Array<out R>, transform: (Float, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> IntArray.zip(array: Array<out R>, transform: (Int, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> LongArray.zip(array: Array<out R>, transform: (Long, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> ShortArray.zip(array: Array<out R>, transform: (Short, R) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun BooleanArray.zip(array: BooleanArray): List<Pair<Boolean, Boolean>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun ByteArray.zip(array: ByteArray): List<Pair<Byte, Byte>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun CharArray.zip(array: CharArray): List<Pair<Char, Char>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun DoubleArray.zip(array: DoubleArray): List<Pair<Double, Double>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun FloatArray.zip(array: FloatArray): List<Pair<Float, Float>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun IntArray.zip(array: IntArray): List<Pair<Int, Int>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun LongArray.zip(array: LongArray): List<Pair<Long, Long>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun ShortArray.zip(array: ShortArray): List<Pair<Short, Short>> {
|
|
|
|
|
return merge(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(array) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <V> BooleanArray.zip(array: BooleanArray, transform: (Boolean, Boolean) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <V> ByteArray.zip(array: ByteArray, transform: (Byte, Byte) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <V> CharArray.zip(array: CharArray, transform: (Char, Char) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <V> DoubleArray.zip(array: DoubleArray, transform: (Double, Double) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <V> FloatArray.zip(array: FloatArray, transform: (Float, Float) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <V> IntArray.zip(array: IntArray, transform: (Int, Int) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <V> LongArray.zip(array: LongArray, transform: (Long, Long) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <V> ShortArray.zip(array: ShortArray, transform: (Short, Short) -> V): List<V> {
|
|
|
|
|
val size = Math.min(size(), array.size())
|
|
|
|
|
val list = ArrayList<V>(size)
|
|
|
|
|
for (i in 0..size-1) {
|
|
|
|
|
list.add(transform(this[i], array[i]))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <T, R> Array<out T>.zip(other: Iterable<R>): List<Pair<T, R>> {
|
|
|
|
|
return merge(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> BooleanArray.zip(other: Iterable<R>): List<Pair<Boolean, R>> {
|
|
|
|
|
return merge(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> ByteArray.zip(other: Iterable<R>): List<Pair<Byte, R>> {
|
|
|
|
|
return merge(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> CharArray.zip(other: Iterable<R>): List<Pair<Char, R>> {
|
|
|
|
|
return merge(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> DoubleArray.zip(other: Iterable<R>): List<Pair<Double, R>> {
|
|
|
|
|
return merge(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> FloatArray.zip(other: Iterable<R>): List<Pair<Float, R>> {
|
|
|
|
|
return merge(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> IntArray.zip(other: Iterable<R>): List<Pair<Int, R>> {
|
|
|
|
|
return merge(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> LongArray.zip(other: Iterable<R>): List<Pair<Long, R>> {
|
|
|
|
|
return merge(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public fun <R> ShortArray.zip(other: Iterable<R>): List<Pair<Short, R>> {
|
|
|
|
|
return merge(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
return zip(other) { t1, t2 -> t1 to t2 }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <T, R, V> Array<out T>.zip(other: Iterable<R>, transform: (T, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> BooleanArray.zip(other: Iterable<R>, transform: (Boolean, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> ByteArray.zip(other: Iterable<R>, transform: (Byte, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> CharArray.zip(other: Iterable<R>, transform: (Char, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> DoubleArray.zip(other: Iterable<R>, transform: (Double, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> FloatArray.zip(other: Iterable<R>, transform: (Float, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> IntArray.zip(other: Iterable<R>, transform: (Int, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> LongArray.zip(other: Iterable<R>, transform: (Long, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
|
|
|
|
|
*/
|
|
|
|
|
public inline fun <R, V> ShortArray.zip(other: Iterable<R>, transform: (Short, R) -> V): List<V> {
|
|
|
|
|
val arraySize = size()
|
|
|
|
|
val list = ArrayList<V>(Math.min(other.collectionSizeOrDefault(10), arraySize))
|
|
|
|
|
var i = 0
|
|
|
|
|
for (element in other) {
|
|
|
|
|
if (i >= arraySize) break
|
|
|
|
|
list.add(transform(this[i++], element))
|
|
|
|
|
}
|
|
|
|
|
return list
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|