Server Side Kotlin-05

Server Side Kotlin-05


1 min read


In the last post of this series, I discussed the Kotlin Collection Map API. In this post, I wil share how zip APIs work.

Zipping transformation(zip() extension function) is used to build pairs from different collection with element of same positions . It is also applicable to array with another collection or array with another array. zip() returns the List of pair objects.

val lang = listOf("java", "c#", "python","javascript")

val frameworks = listOf("spring", "aspnetcore", "django", "nodejs")
println( lang zip frameworks)


[(java, spring), (c#, aspnetcore), (python, django), (javascript, nodejs)]


You can see how this zip works. In the next post, I will explore the Associate APIs.