Created
October 12, 2020 12:35
-
-
Save ch8n/e0c2695e973488189c499520c4e1bf6e to your computer and use it in GitHub Desktop.
map resolved by Singleton 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 <K, V> mapOf(pair: Pair<K, V>): Map<K, V> | |
= java.util.Collections.singletonMap(pair.first, pair.second) | |
// In java.util.Collections, | |
public static Map singletonMap(K key, V value) | |
//a function that return an immutable map, which is serializable. | |
//it is mapping only the specified key to the specified value. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment