Created
October 12, 2020 13:37
-
-
Save ch8n/390701cc633d8c1c636f61abc4dc9ade to your computer and use it in GitHub Desktop.
linkedhashMap definition in kotlin
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 <K, V> linkedMapOf(vararg pairs: Pair<K, V>): LinkedHashMap<K, V> | |
= pairs.toMap(LinkedHashMap(mapCapacity(pairs.size))) | |
// this factory function takes pair and uses LinkedHashMap's second constructor which | |
// start off with the object capacity as the number of pairs passed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment