summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/LinearSeqLike.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2009-11-24 10:19:08 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2009-11-24 10:19:08 +0000
commitb93068347ee73cf092e2f902cdd0d591a7d9ae1d (patch)
treed40349770a5c1cf2d9498de05e2a9d69316fc66c /src/library/scala/collection/LinearSeqLike.scala
parentcc44d56c425b23924744dae3456db8a2176f982d (diff)
downloadscala-b93068347ee73cf092e2f902cdd0d591a7d9ae1d.tar.gz
scala-b93068347ee73cf092e2f902cdd0d591a7d9ae1d.tar.bz2
scala-b93068347ee73cf092e2f902cdd0d591a7d9ae1d.zip
close #2626 as specified by Martin
Diffstat (limited to 'src/library/scala/collection/LinearSeqLike.scala')
-rw-r--r--src/library/scala/collection/LinearSeqLike.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/library/scala/collection/LinearSeqLike.scala b/src/library/scala/collection/LinearSeqLike.scala
index a9b33305fd..70ff3463c8 100644
--- a/src/library/scala/collection/LinearSeqLike.scala
+++ b/src/library/scala/collection/LinearSeqLike.scala
@@ -60,7 +60,10 @@ trait LinearSeqLike[+A, +Repr <: LinearSeqLike[A, Repr]] extends SeqLike[A, Repr
* @return the element at position <code>n</code> in this linear sequence.
* @throws Predef.NoSuchElementException if the linear sequence is too short.
*/
- def apply(n: Int): A = drop(n).head
+ def apply(n: Int): A = {
+ require(n >= 0)
+ drop(n).head
+ }
/** Returns the elements in the sequence as an iterator
*/