summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/mutable/SetLike.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/collection/mutable/SetLike.scala')
-rw-r--r--src/library/scala/collection/mutable/SetLike.scala13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/library/scala/collection/mutable/SetLike.scala b/src/library/scala/collection/mutable/SetLike.scala
index 01075a2633..0797a83154 100644
--- a/src/library/scala/collection/mutable/SetLike.scala
+++ b/src/library/scala/collection/mutable/SetLike.scala
@@ -72,6 +72,17 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]]
protected[this] override def parCombiner = ParSet.newCombiner[A]
+ /** Converts this $coll to a sequence.
+ *
+ * ```Note```: assumes a fast `size` method. Subclasses should override if this is not true.
+ */
+ override def toSeq: collection.Seq[A] = {
+ // ArrayBuffer for efficiency, preallocated to the right size.
+ val result = new ArrayBuffer[A](size)
+ foreach(result += _)
+ result
+ }
+
/** Adds an element to this $coll.
*
* @param elem the element to be added
@@ -213,7 +224,7 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]]
* @throws UnsupportedOperationException
* if the message was not understood.
*/
- @deprecated("Scripting is deprecated.", "2.11.0")
+ @deprecated("scripting is deprecated", "2.11.0")
def <<(cmd: Message[A]): Unit = cmd match {
case Include(_, x) => this += x
case Remove(_, x) => this -= x