From 088d4aef3fd8cd33a32b907335e7c6d71cd0ca58 Mon Sep 17 00:00:00 2001 From: michelou Date: Wed, 27 Jun 2007 16:09:23 +0000 Subject: modified test in "drop" (like Stream) --- src/library/scala/List.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/library/scala/List.scala b/src/library/scala/List.scala index 1b1299b25a..5f0d80c890 100644 --- a/src/library/scala/List.scala +++ b/src/library/scala/List.scala @@ -559,7 +559,7 @@ sealed abstract class List[+A] extends Seq[A] { * @return the list without its n first elements. */ override def drop(n: Int): List[A] = - if (n == 0 || isEmpty) this + if (isEmpty || n <= 0) this else (tail drop (n-1)) /** Returns the rightmost n elements from this list. @@ -633,7 +633,7 @@ sealed abstract class List[+A] extends Seq[A] { */ override def dropWhile(p: A => Boolean): List[A] = if (isEmpty || !p(head)) this - else tail dropWhile p; + else tail dropWhile p /** Returns the longest prefix of the list whose elements all satisfy * the given predicate, and the rest of the list. -- cgit v1.2.3