Concurrent getOrPut for concurrent maps.

#KT-5800 Fixed
This commit is contained in:
Ilya Gorbunov
2015-07-06 16:48:38 +03:00
parent c7b26ed7ca
commit 83f9ee2737
2 changed files with 22 additions and 2 deletions
@@ -1,6 +1,7 @@
package test.collections
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ConcurrentMap
import kotlin.test.*
import org.junit.Test as test
@@ -45,6 +46,9 @@ class MapJVMTest {
fails {
map.getOrPut("x") { 1 }
}
expect(1) {
map.concurrentGetOrPut("x") { 1 }
}
expect(1) {
(map as MutableMap<String, Int>).getOrPut("x") { 1 }
}