diff options
-rw-r--r-- | src/library/scala/List.scala | 4 |
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. |