diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2009-11-24 10:19:08 +0000 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2009-11-24 10:19:08 +0000 |
commit | b93068347ee73cf092e2f902cdd0d591a7d9ae1d (patch) | |
tree | d40349770a5c1cf2d9498de05e2a9d69316fc66c /src | |
parent | cc44d56c425b23924744dae3456db8a2176f982d (diff) | |
download | scala-b93068347ee73cf092e2f902cdd0d591a7d9ae1d.tar.gz scala-b93068347ee73cf092e2f902cdd0d591a7d9ae1d.tar.bz2 scala-b93068347ee73cf092e2f902cdd0d591a7d9ae1d.zip |
close #2626 as specified by Martin
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/collection/LinearSeqLike.scala | 5 |
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 */ |