summaryrefslogtreecommitdiff
path: root/test/files/run/map_java_conversions.scala
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@epfl.ch>2011-11-02 14:34:35 +0000
committerHubert Plociniczak <hubert.plociniczak@epfl.ch>2011-11-02 14:34:35 +0000
commitb6778be91900b8161e705dc2598ef7af86842b0b (patch)
treed15e8ec18a37eec212f50f1ace27714d7e7d4d34 /test/files/run/map_java_conversions.scala
parentac6c76f26d884a94d0c9ff54f055d3f9ab750bac (diff)
downloadscala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.gz
scala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.bz2
scala-b6778be91900b8161e705dc2598ef7af86842b0b.zip
Begone t1737...
Diffstat (limited to 'test/files/run/map_java_conversions.scala')
-rw-r--r--test/files/run/map_java_conversions.scala24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/files/run/map_java_conversions.scala b/test/files/run/map_java_conversions.scala
index a41fae3695..7714b2cc74 100644
--- a/test/files/run/map_java_conversions.scala
+++ b/test/files/run/map_java_conversions.scala
@@ -4,20 +4,20 @@
object Test {
-
+
def main(args: Array[String]) {
import collection.JavaConversions._
-
+
test(new java.util.HashMap[String, String])
test(new java.util.Properties)
testConcMap
}
-
+
def testConcMap {
import collection.JavaConversions._
-
+
val concMap = new java.util.concurrent.ConcurrentHashMap[String, String]
-
+
test(concMap)
val cmap = asScalaConcurrentMap(concMap)
cmap.putIfAbsent("absentKey", "absentValue")
@@ -26,31 +26,31 @@ object Test {
assert(cmap.replace("absentKey", "newAbsentValue") == Some("absentValue"))
assert(cmap.replace("absentKey", "newAbsentValue", ".......") == true)
}
-
+
def test(m: collection.mutable.Map[String, String]) {
m.clear
assert(m.size == 0)
-
+
m.put("key", "value")
assert(m.size == 1)
-
+
assert(m.put("key", "anotherValue") == Some("value"))
assert(m.put("key2", "value2") == None)
assert(m.size == 2)
-
+
m += (("key3", "value3"))
assert(m.size == 3)
-
+
m -= "key2"
assert(m.size == 2)
assert(m.nonEmpty)
assert(m.remove("key") == Some("anotherValue"))
-
+
m.clear
for (i <- 0 until 10) m += (("key" + i, "value" + i))
for ((k, v) <- m) assert(k.startsWith("key"))
}
-
+
}