Map.getOrPut: treat nulls as missing values.

This commit is contained in:
Ilya Gorbunov
2016-01-22 07:47:54 +03:00
parent a49db730a9
commit 23080f78f7
8 changed files with 21 additions and 44 deletions
@@ -2,5 +2,5 @@ fun box(): String {
val m = hashMapOf<String, String?>()
m.put("b", null)
val oldValue = m.getOrPut("b", { "Foo" })
return if (oldValue == null) "OK" else "fail: $oldValue"
return if (oldValue == "Foo") "OK" else "fail: $oldValue"
}