summaryrefslogtreecommitdiff
path: root/src/library/scala/List.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/List.scala')
-rw-r--r--src/library/scala/List.scala11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/library/scala/List.scala b/src/library/scala/List.scala
index f6f10161d6..23667f68d7 100644
--- a/src/library/scala/List.scala
+++ b/src/library/scala/List.scala
@@ -1276,8 +1276,15 @@ sealed abstract class List[+A] extends Seq[A] {
* @return this list without the elements of the given object
* <code>x</code>.
*/
- def - [B >: A](x: B): List[B] =
- this -- List(x)
+ def - [B >: A](x: B): List[B] = {
+ val b = new ListBuffer[B]
+ var these = this
+ while (!these.isEmpty) {
+ if (these.head != x) b += these.head
+ these = these.tail
+ }
+ b.toList
+ }
/** Concatenate the elements of this list. The elements of this list
* should be a <code>Iterables</code>.