From 69b9d9858e6127d021e083d336e9629c12173698 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 4 Jul 2011 04:54:24 +0000 Subject: Hard to explain garbage led me to this innocent... Hard to explain garbage led me to this innocent seeming change. Not that innocent. A function like this should create no garbage: final def f[T](xs: List[T], num: Int) { if (num > 0) f(Nil ::: xs ::: Nil, num - 1) } Instead it was creating a lot. No review. --- src/library/scala/collection/immutable/List.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index 5446b25888..563f14eac6 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -75,6 +75,7 @@ sealed abstract class List[+A] extends LinearSeq[A] */ def :::[B >: A](prefix: List[B]): List[B] = if (isEmpty) prefix + else if (prefix.isEmpty) this else (new ListBuffer[B] ++= prefix).prependToList(this) /** Adds the elements of a given list in reverse order in front of this list. -- cgit v1.2.3