summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-03-28 16:03:29 +0000
committerpaltherr <paltherr@epfl.ch>2003-03-28 16:03:29 +0000
commit2ed373a5c30472fe76583bde8c38fd6ff8461cb2 (patch)
tree29b9eaa3d65719359744e3290b812d3ab32c7217
parent5c24c955335d5dc2018042db5b0b0ee4a92663b6 (diff)
downloadscala-2ed373a5c30472fe76583bde8c38fd6ff8461cb2.tar.gz
scala-2ed373a5c30472fe76583bde8c38fd6ff8461cb2.tar.bz2
scala-2ed373a5c30472fe76583bde8c38fd6ff8461cb2.zip
- Fixed method copyToArray
-rw-r--r--sources/scala/List.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/sources/scala/List.scala b/sources/scala/List.scala
index b94d6060db..2d6464955c 100644
--- a/sources/scala/List.scala
+++ b/sources/scala/List.scala
@@ -251,9 +251,9 @@ trait List[a] extends Seq[a] {
* @return the given array <code>xs</code> filled with this list.
* @throws error if the list is empty.
*/
- def copyToArray(xs: Array[a], start: Int): Int = {
- xs(start) = head;
- tail.copyToArray(xs, start + 1)
+ def copyToArray(xs: Array[a], start: Int): Array[a] = match {
+ case Nil => xs
+ case y :: ys => xs(start) = y; ys.copyToArray(xs, start + 1)
}
/** Returns a string representation of this list. The resulting string