zip (original) (raw)

Returns a list of pairs built from the elements of this array and the other array with the same index. The returned list has length of the shortest collection.

Since Kotlin

1.0

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
println(listA zip listB) // [(a, 1), (b, 2), (c, 3)] 
   //sampleEnd
}

Returns a list of values built from the elements of this array and the other array with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest collection.

Since Kotlin

1.0

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
val result = listA.zip(listB) { a, b -> "$a$b" }
println(result) // [a1, b2, c3] 
   //sampleEnd
}

Returns a list of pairs built from the elements of this collection and other array with the same index. The returned list has length of the shortest collection.

Since Kotlin

1.0

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
println(listA zip listB) // [(a, 1), (b, 2), (c, 3)] 
   //sampleEnd
}

Returns a list of values built from the elements of this array and the other collection with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest collection.

Since Kotlin

1.0

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
val result = listA.zip(listB) { a, b -> "$a$b" }
println(result) // [a1, b2, c3] 
   //sampleEnd
}

Returns a list of values built from the elements of this array and the other array with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest array.

Since Kotlin

1.0

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
val result = listA.zip(listB) { a, b -> "$a$b" }
println(result) // [a1, b2, c3] 
   //sampleEnd
}

Returns a list of pairs built from the elements of this collection and the other array with the same index. The returned list has length of the shortest collection.

Since Kotlin

1.0

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
println(listA zip listB) // [(a, 1), (b, 2), (c, 3)] 
   //sampleEnd
}

Returns a list of values built from the elements of this collection and the other array with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest collection.

Since Kotlin

1.0

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
val result = listA.zip(listB) { a, b -> "$a$b" }
println(result) // [a1, b2, c3] 
   //sampleEnd
}

Returns a list of pairs built from the elements of this collection and other collection with the same index. The returned list has length of the shortest collection.

Since Kotlin

1.0

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
println(listA zip listB) // [(a, 1), (b, 2), (c, 3)] 
   //sampleEnd
}

Returns a list of values built from the elements of this collection and the other collection with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest collection.

Since Kotlin

1.0

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
val result = listA.zip(listB) { a, b -> "$a$b" }
println(result) // [a1, b2, c3] 
   //sampleEnd
}

Returns a list of pairs built from the elements of this array and the other array with the same index. The returned list has length of the shortest collection.

Since Kotlin

1.3

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
println(listA zip listB) // [(a, 1), (b, 2), (c, 3)] 
   //sampleEnd
}

Returns a list of values built from the elements of this array and the other array with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest collection.

Since Kotlin

1.3

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
val result = listA.zip(listB) { a, b -> "$a$b" }
println(result) // [a1, b2, c3] 
   //sampleEnd
}

Returns a list of pairs built from the elements of this collection and other array with the same index. The returned list has length of the shortest collection.

Since Kotlin

1.3

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
println(listA zip listB) // [(a, 1), (b, 2), (c, 3)] 
   //sampleEnd
}

Returns a list of values built from the elements of this array and the other collection with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest collection.

Since Kotlin

1.3

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
val result = listA.zip(listB) { a, b -> "$a$b" }
println(result) // [a1, b2, c3] 
   //sampleEnd
}

Returns a list of values built from the elements of this array and the other array with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest array.

Since Kotlin

1.3

Samples


fun main() { 
   //sampleStart 
   val listA = listOf("a", "b", "c")
val listB = listOf(1, 2, 3, 4)
val result = listA.zip(listB) { a, b -> "$a$b" }
println(result) // [a1, b2, c3] 
   //sampleEnd
}