Skip to content

Instantly share code, notes, and snippets.

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