diff options
author | Paul Phillips <paulp@improving.org> | 2010-12-14 18:11:48 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-12-14 18:11:48 +0000 |
commit | 799bd96931386ab3bfa160e738dbf10fb42c0efe (patch) | |
tree | 60eb687a4b33729706b0249002f2073765c83bb3 /src | |
parent | c514c35b2e923f7df865b1ff37b4293a0724c0f4 (diff) | |
download | scala-799bd96931386ab3bfa160e738dbf10fb42c0efe.tar.gz scala-799bd96931386ab3bfa160e738dbf10fb42c0efe.tar.bz2 scala-799bd96931386ab3bfa160e738dbf10fb42c0efe.zip |
Modified TreeMap to return a fresh empty node u...
Modified TreeMap to return a fresh empty node upon removing the last
element rather than the existing one, so old objects don't remain
uncollectable forever. No review.
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/collection/immutable/TreeMap.scala | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/library/scala/collection/immutable/TreeMap.scala b/src/library/scala/collection/immutable/TreeMap.scala index d54c31dec8..ff595ebed7 100644 --- a/src/library/scala/collection/immutable/TreeMap.scala +++ b/src/library/scala/collection/immutable/TreeMap.scala @@ -120,6 +120,7 @@ class TreeMap[A, +B](override val size: Int, t: RedBlack[A]#Tree[B])(implicit va def - (key:A): TreeMap[A, B] = if (tree.lookup(key).isEmpty) this + else if (size == 1) empty else TreeMap.make(size - 1, tree.delete(key)) /** Check if this map maps `key` to a value and return the |