renamed the rather long getOrElseUpdate to a simpler getOrPut which is a bit simpler and more accurate; as a new entry is put into the Map if its null

This commit is contained in:
James Strachan
2012-02-21 11:11:43 +00:00
parent 724f7860ab
commit a68b00dfd4
4 changed files with 8 additions and 7 deletions
+3 -3
View File
@@ -21,11 +21,11 @@ class MapTest() : TestSupport() {
assertEquals(0, data.size)
}
fun testGetOrElseUpdate() {
val a = data.getOrElseUpdate("foo"){2}
fun testGetOrPut() {
val a = data.getOrPut("foo"){2}
assertEquals(2, a)
val b = data.getOrElseUpdate("foo"){3}
val b = data.getOrPut("foo"){3}
assertEquals(2, b)
assertEquals(1, data.size())