diff options
author | stepancheg <stepancheg@epfl.ch> | 2008-05-27 13:22:46 +0000 |
---|---|---|
committer | stepancheg <stepancheg@epfl.ch> | 2008-05-27 13:22:46 +0000 |
commit | 6f638318d68d360157b87861842ad5f3b9e04079 (patch) | |
tree | 89adb1fe60a9a9bfef71f0ba421740a4a3ac5c04 /src/library | |
parent | 859f7497e1be11fb81e4678990fccdbc093ac403 (diff) | |
download | scala-6f638318d68d360157b87861842ad5f3b9e04079.tar.gz scala-6f638318d68d360157b87861842ad5f3b9e04079.tar.bz2 scala-6f638318d68d360157b87861842ad5f3b9e04079.zip |
make List.++ faster if argument is List (#887)
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/List.scala | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/library/scala/List.scala b/src/library/scala/List.scala index 2486aac041..0198813914 100644 --- a/src/library/scala/List.scala +++ b/src/library/scala/List.scala @@ -523,12 +523,8 @@ sealed abstract class List[+A] extends Seq[A] { /** Appends two list objects. */ - override def ++[B >: A](that: Iterable[B]): List[B] = { - val buf = new ListBuffer[B] - this copyToBuffer buf - that copyToBuffer buf - buf.toList - } + override def ++[B >: A](that: Iterable[B]): List[B] = + this ::: that.toList /** Reverse the given prefix and append the current list to that. * This function is equivalent to an application of <code>reverse</code> |