Created
August 19, 2016 15:50
-
-
Save aembleton/922e27b352dba5bfa329dce5f5ee50bc to your computer and use it in GitHub Desktop.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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