Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create a map from a list of Strings. Split the string with a splitter String. Useful for reading in a list of comma seperated String and converting them into a map.
fun List<String>.mapWith(split:String) = this.map {
val components = it.split(split, limit=2)
components[0].trim() to components[1].trim()
}.toMap()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.