diff options
author | Martin Odersky <odersky@gmail.com> | 2007-03-28 16:33:37 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-03-28 16:33:37 +0000 |
commit | 1ab4fbc3b92d249f7a354ad0cfd794a3196fd95a (patch) | |
tree | 99ebc29a3faefa9bf8689b24d26a8808d375b799 /src/library | |
parent | eabe0b477d8169934d296682f1a12e8c707d5de7 (diff) | |
download | scala-1ab4fbc3b92d249f7a354ad0cfd794a3196fd95a.tar.gz scala-1ab4fbc3b92d249f7a354ad0cfd794a3196fd95a.tar.bz2 scala-1ab4fbc3b92d249f7a354ad0cfd794a3196fd95a.zip |
Fixed problem with sensibility checks.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/immutable/HashMap.scala | 10 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/HashSet.scala | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/library/scala/collection/immutable/HashMap.scala b/src/library/scala/collection/immutable/HashMap.scala index 93f64d0fdb..35aa93d579 100644 --- a/src/library/scala/collection/immutable/HashMap.scala +++ b/src/library/scala/collection/immutable/HashMap.scala @@ -44,7 +44,7 @@ class HashMap[A, B] extends Map[A,B] with mutable.HashTable[A] { def empty[C]: Map[A, C] = new EmptyMap[A, C] - def get(key: A): Option[B] = { + def get(key: A): Option[B] = synchronized { var m = this var cnt = 0 while (m.later != null) { @@ -58,7 +58,7 @@ class HashMap[A, B] extends Map[A,B] with mutable.HashTable[A] { else Some(getValue(e)) } - def update [B1 >: B](key: A, value: B1): Map[A, B1] = { + def update [B1 >: B](key: A, value: B1): Map[A, B1] = synchronized { makeCopyIfUpdated() val e = findEntry(key) if (e == null) { @@ -71,7 +71,7 @@ class HashMap[A, B] extends Map[A,B] with mutable.HashTable[A] { later } - def - (key: A): Map[A, B] = { + def - (key: A): Map[A, B] = synchronized { makeCopyIfUpdated() val e = findEntry(key) if (e == null) this @@ -82,7 +82,7 @@ class HashMap[A, B] extends Map[A,B] with mutable.HashTable[A] { } } - override def size: int = { + override def size: int = synchronized { var m = this var cnt = 0 var s = tableSize @@ -95,7 +95,7 @@ class HashMap[A, B] extends Map[A,B] with mutable.HashTable[A] { s } - def elements = { + def elements = synchronized { makeCopyIfUpdated() entries map {e => (e.key, getValue(e))} } diff --git a/src/library/scala/collection/immutable/HashSet.scala b/src/library/scala/collection/immutable/HashSet.scala index 0b47460408..2f081d98ca 100644 --- a/src/library/scala/collection/immutable/HashSet.scala +++ b/src/library/scala/collection/immutable/HashSet.scala @@ -39,7 +39,7 @@ class HashSet[A] extends Set[A] with mutable.FlatHashTable[A] { def empty[C]: Set[C] = new EmptySet[C] - def contains(elem: A): Boolean = { + def contains(elem: A): Boolean = synchronized { var m = this var cnt = 0 while (m.later != null) { @@ -51,7 +51,7 @@ class HashSet[A] extends Set[A] with mutable.FlatHashTable[A] { m.containsEntry(elem) } - def + (elem: A): Set[A] = { + def + (elem: A): Set[A] = synchronized { makeCopyIfUpdated() if (containsEntry(elem)) this else { @@ -61,7 +61,7 @@ class HashSet[A] extends Set[A] with mutable.FlatHashTable[A] { } } - def - (elem: A): Set[A] = { + def - (elem: A): Set[A] = synchronized { makeCopyIfUpdated() if (!containsEntry(elem)) this else { @@ -71,7 +71,7 @@ class HashSet[A] extends Set[A] with mutable.FlatHashTable[A] { } } - override def size: Int = { + override def size: Int = synchronized { var m = this var cnt = 0 var s = tableSize @@ -84,7 +84,7 @@ class HashSet[A] extends Set[A] with mutable.FlatHashTable[A] { s } - override def elements = { + override def elements = synchronized { makeCopyIfUpdated() super.elements } |