Skip to content

Instantly share code, notes, and snippets.

@ch8n
Created October 12, 2020 13:30
Show Gist options
  • Save ch8n/2235258a097ffa8f20ee43b5761727e9 to your computer and use it in GitHub Desktop.
Save ch8n/2235258a097ffa8f20ee43b5761727e9 to your computer and use it in GitHub Desktop.
map to hashmap in kotlin
// Directly use the 4th constructor example
val contact = mapOf("chetan" to "[email protected]")
val hashMapOfContact = HashMap(contact)
//Or create and add all entries
val hashMapOfContact = HashMap<String,Int>()
hashMapOfContact.putAll(contact)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment