summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/immutable/TreeMap.scala
diff options
context:
space:
mode:
authorAleksandar Prokopec <axel22@gmail.com>2012-06-27 13:34:49 +0200
committerAleksandar Prokopec <axel22@gmail.com>2012-06-27 15:49:06 +0200
commit788ac7502154ca1329773ec869242df21015f5f3 (patch)
treebb330ef73645f25ce872900a8a485e066197cecf /src/library/scala/collection/immutable/TreeMap.scala
parent9a28ee1ffc085bc680c48b12ad632b9133adf020 (diff)
downloadscala-788ac7502154ca1329773ec869242df21015f5f3.tar.gz
scala-788ac7502154ca1329773ec869242df21015f5f3.tar.bz2
scala-788ac7502154ca1329773ec869242df21015f5f3.zip
Fix SI-5986.
Here we had an issue that RedBlack does not work the same way for sets - which are not supposed to replace an element if it is the same (wrt equals) and maps - which should replace the corresponding values. Adding an overwrite parameter which decides whether to overwrite added keys if they are the same in the ordering. Fix tests.
Diffstat (limited to 'src/library/scala/collection/immutable/TreeMap.scala')
-rw-r--r--src/library/scala/collection/immutable/TreeMap.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/scala/collection/immutable/TreeMap.scala b/src/library/scala/collection/immutable/TreeMap.scala
index 4c1a5f2e03..51bc76efc3 100644
--- a/src/library/scala/collection/immutable/TreeMap.scala
+++ b/src/library/scala/collection/immutable/TreeMap.scala
@@ -131,7 +131,7 @@ class TreeMap[A, +B] private (tree: RB.Tree[A, B])(implicit val ordering: Orderi
* @param value the value to be associated with `key`
* @return a new $coll with the updated binding
*/
- override def updated [B1 >: B](key: A, value: B1): TreeMap[A, B1] = new TreeMap(RB.update(tree, key, value))
+ override def updated [B1 >: B](key: A, value: B1): TreeMap[A, B1] = new TreeMap(RB.update(tree, key, value, true))
/** Add a key/value pair to this map.
* @tparam B1 type of the value of the new binding, a supertype of `B`
@@ -171,7 +171,7 @@ class TreeMap[A, +B] private (tree: RB.Tree[A, B])(implicit val ordering: Orderi
*/
def insert [B1 >: B](key: A, value: B1): TreeMap[A, B1] = {
assert(!RB.contains(tree, key))
- new TreeMap(RB.update(tree, key, value))
+ new TreeMap(RB.update(tree, key, value, true))
}
def - (key:A): TreeMap[A, B] =