@@ -35,7 +35,12 @@ trait Set[A] extends Iterable[A]
35
35
override def companion : GenericCompanion [Set ] = Set
36
36
37
37
38
- override def toSet [B >: A ]: Set [B ] = to[({type l [a] = immutable.Set [B ]})# l] // for bincompat; remove in dev
38
+ /** Returns this $coll as an immutable map.
39
+ *
40
+ * A new map will not be built; lazy collections will stay lazy.
41
+ */
42
+ @ deprecatedOverriding(" Immutable sets should do nothing on toSet but return themselves cast as a Set." , " 2.11.0" )
43
+ override def toSet [B >: A ]: Set [B ] = this .asInstanceOf [Set [B ]]
39
44
40
45
override def seq : Set [A ] = this
41
46
protected override def parCombiner = ParSet .newCombiner[A ] // if `immutable.SetLike` gets introduced, please move this there!
@@ -57,7 +62,6 @@ object Set extends ImmutableSetFactory[Set] {
57
62
def - (elem : Any ): Set [Any ] = this
58
63
def iterator : Iterator [Any ] = Iterator .empty
59
64
override def foreach [U ](f : Any => U ): Unit = {}
60
- override def toSet [B >: Any ]: Set [B ] = this .asInstanceOf [Set [B ]]
61
65
}
62
66
private [collection] def emptyInstance : Set [Any ] = EmptySet
63
67
@@ -88,8 +92,6 @@ object Set extends ImmutableSetFactory[Set] {
88
92
if (f(elem1)) Some (elem1)
89
93
else None
90
94
}
91
- @ deprecatedOverriding(" Immutable sets should do nothing on toSet but return themselves cast as a Set." , " 2.11.0" )
92
- override def toSet [B >: A ]: Set [B ] = this .asInstanceOf [Set [B ]]
93
95
}
94
96
95
97
/** An optimized representation for immutable sets of size 2 */
@@ -121,8 +123,6 @@ object Set extends ImmutableSetFactory[Set] {
121
123
else if (f(elem2)) Some (elem2)
122
124
else None
123
125
}
124
- @ deprecatedOverriding(" Immutable sets should do nothing on toSet but return themselves cast as a Set." , " 2.11.0" )
125
- override def toSet [B >: A ]: Set [B ] = this .asInstanceOf [Set [B ]]
126
126
}
127
127
128
128
/** An optimized representation for immutable sets of size 3 */
@@ -156,8 +156,6 @@ object Set extends ImmutableSetFactory[Set] {
156
156
else if (f(elem3)) Some (elem3)
157
157
else None
158
158
}
159
- @ deprecatedOverriding(" Immutable sets should do nothing on toSet but return themselves cast as a Set." , " 2.11.0" )
160
- override def toSet [B >: A ]: Set [B ] = this .asInstanceOf [Set [B ]]
161
159
}
162
160
163
161
/** An optimized representation for immutable sets of size 4 */
<
8000
path d="m8.177 14.323 2.896-2.896a.25.25 0 0 0-.177-.427H8.75V7.764a.75.75 0 1 0-1.5 0V11H5.104a.25.25 0 0 0-.177.427l2.896 2.896a.25.25 0 0 0 .354 0ZM2.25 5a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5ZM6 4.25a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1 0-1.5h.5a.75.75 0 0 1 .75.75ZM8.25 5a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5ZM12 4.25a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1 0-1.5h.5a.75.75 0 0 1 .75.75Zm2.25.75a.75.75 0 0 0 0-1.5h-.5a.75.75 0 0 0 0 1.5h.5Z"> @@ -193,8 +191,6 @@ object Set extends ImmutableSetFactory[Set] {
193
191
else if (f(elem4)) Some (elem4)
194
192
else None
195
193
}
196
- @ deprecatedOverriding(" Immutable sets should do nothing on toSet but return themselves cast as a Set." , " 2.11.0" )
197
- override def toSet [B >: A ]: Set [B ] = this .asInstanceOf [Set [B ]]
198
194
}
199
195
}
200
196
0 commit comments