apatrida
10/16/2015, 6:41 PMpublic fun <K: Any, V: Any> Map<K,V>.toFunc(): (K)->V? {
return fun (key: K): V? { return this[key] }
}
public fun foo() {
val myMap = mapOf("this" to "that")
val func = myMap.toFunc()
func("this") // returns "that"
}
then just myMap.toFunc()
and use your function