Skip to content

Instantly share code, notes, and snippets.

@ch8n
Created October 12, 2020 12:35
Show Gist options
  • Save ch8n/e0c2695e973488189c499520c4e1bf6e to your computer and use it in GitHub Desktop.
Save ch8n/e0c2695e973488189c499520c4e1bf6e to your computer and use it in GitHub Desktop.
map resolved by Singleton map
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