Skip to content

Commit 9ecaee1

Browse files
authored
Merge pull request scala/scala#7019 from szeiger/issue/10988
Make mutable Sets and Maps their own Builders
2 parents 06ffeff + dd734c1 commit 9ecaee1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

library/src/scala/collection/mutable/Map.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ trait MapOps[K, V, +CC[X, Y] <: MapOps[X, Y, CC, _], +C <: MapOps[K, V, CC, C]]
5555
extends IterableOps[(K, V), Iterable, C]
5656
with collection.MapOps[K, V, CC, C]
5757
with Cloneable[C]
58+
with Builder[(K, V), C]
5859
with Growable[(K, V)]
5960
with Shrinkable[K] {
6061

62+
def result(): C = coll
63+
6164
@deprecated("Use - or remove on an immutable Map", "2.13.0")
6265
@deprecatedOverriding("This method should be final, but is not due to scala/bug#10853", "2.13.0")
6366
/*final*/ def - (key: K): C = clone() -= key

library/src/scala/collection/mutable/Set.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ trait Set[A]
1919
trait SetOps[A, +CC[X], +C <: SetOps[A, CC, C]]
2020
extends collection.SetOps[A, CC, C]
2121
with Cloneable[C]
22+
with Builder[A, C]
2223
with Growable[A]
2324
with Shrinkable[A] {
2425

26+
def result(): C = coll
2527

2628
def add(elem: A): Boolean =
2729
!contains(elem) && {

0 commit comments

Comments
 (0)