Server Side Kotlin-06

Server Side Kotlin-06


1 min read


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

Association transformations make build maps for collection elements with some certain values . In collection, elements can be either keys or values in the association map.

The basic association function associateWith() creates a Map in which the elements of the collection are keys, and while transformation,these elements produces values.

val gameengines = listOf("unity", "unreal","godot") println(gameengines.associateWith {it.length})
{unity=5, unreal=6, godot=5}


You can see how this associate works. In the next post, I will explore the flatten APIs work.