The Kotlin version is a bit awkward because of the absence of SAM conversion but not unexpected:
Copy code
val m = hashMapOf<String, String>()
val f = BiFunction { k: String, v: String? ->
if (v == null) "defaultString" else v + " added string"
}
m.compute("foo", f)