summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-06-27 16:09:23 +0000
committermichelou <michelou@epfl.ch>2007-06-27 16:09:23 +0000
commit088d4aef3fd8cd33a32b907335e7c6d71cd0ca58 (patch)
tree1d2540d73a3763e389c6a65c4afb280912ebfea7
parentb4b91dcb58b5804f7ec1513e8f4d1e4534fd8018 (diff)
downloadscala-088d4aef3fd8cd33a32b907335e7c6d71cd0ca58.tar.gz
scala-088d4aef3fd8cd33a32b907335e7c6d71cd0ca58.tar.bz2
scala-088d4aef3fd8cd33a32b907335e7c6d71cd0ca58.zip
modified test in "drop" (like Stream)
-rw-r--r--src/library/scala/List.scala4
1 files 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 <code>n</code> 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 <code>n</code> 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.