summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/mutable/SortedSet.scala
diff options
context:
space:
mode:
authorRui Gonçalves <ruippeixotog@gmail.com>2015-07-06 22:56:02 +0100
committerRui Gonçalves <ruippeixotog@gmail.com>2015-07-28 10:12:44 +0100
commitc15259091d43c82053bcacf206eba5da6bc56fe5 (patch)
tree235d06ba881014d47c70b5e381b1c615d84e47b0 /src/library/scala/collection/mutable/SortedSet.scala
parent462e22d2f25bb9432c5a1e7bf20f391e6424f7a9 (diff)
downloadscala-c15259091d43c82053bcacf206eba5da6bc56fe5.tar.gz
scala-c15259091d43c82053bcacf206eba5da6bc56fe5.tar.bz2
scala-c15259091d43c82053bcacf206eba5da6bc56fe5.zip
SI-6938 Use mutable red-black tree in TreeSet
The previous implementation of `mutable.TreeSet` uses a mutable reference to an immutable red-black tree as its underlying data structure. That leads to unnecessary objects being created, which can be a problem in systems with limited resources. It also has reduced performance when compared with common mutable implementations. In this commit `mutable.TreeSet` is changed so that it uses the recently created `mutable.RedBlackTree` as its underlying data structure. Specialized red-black tree methods were created for working with keys for efficiency reasons. The new implementation is source-compatible with the previous one, although its serialized representation obviously changes. Closes [SI-6938](https://issues.scala-lang.org/browse/SI-6938).
Diffstat (limited to 'src/library/scala/collection/mutable/SortedSet.scala')
-rw-r--r--src/library/scala/collection/mutable/SortedSet.scala3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/library/scala/collection/mutable/SortedSet.scala b/src/library/scala/collection/mutable/SortedSet.scala
index 0f2fa75abd..3dee57eb6d 100644
--- a/src/library/scala/collection/mutable/SortedSet.scala
+++ b/src/library/scala/collection/mutable/SortedSet.scala
@@ -48,3 +48,6 @@ object SortedSet extends MutableSortedSetFactory[SortedSet] {
def empty[A](implicit ord: Ordering[A]): SortedSet[A] = TreeSet.empty[A]
}
+
+/** Explicit instantiation of the `SortedSet` trait to reduce class file size in subclasses. */
+abstract class AbstractSortedSet[A] extends scala.collection.mutable.AbstractSet[A] with SortedSet[A]