summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2009-11-08 22:09:49 +0000
committerPhilipp Haller <hallerp@gmail.com>2009-11-08 22:09:49 +0000
commit3ec24991df3d8bcf721ad30a806b4ef8b297728c (patch)
tree1cc1b6595d7b11f55249eeacb61ea6ac6b53c4a0 /src
parentf8187cb5199c4a3f464f46ebdbce31d41351dfcc (diff)
downloadscala-3ec24991df3d8bcf721ad30a806b4ef8b297728c.tar.gz
scala-3ec24991df3d8bcf721ad30a806b4ef8b297728c.tar.bz2
scala-3ec24991df3d8bcf721ad30a806b4ef8b297728c.zip
Fixed collections unit test (regression in List...
Fixed collections unit test (regression in ListBuffer.apply) and serialization test.
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/collection/mutable/ListBuffer.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/library/scala/collection/mutable/ListBuffer.scala b/src/library/scala/collection/mutable/ListBuffer.scala
index 9813a6760b..ee6e672fb1 100644
--- a/src/library/scala/collection/mutable/ListBuffer.scala
+++ b/src/library/scala/collection/mutable/ListBuffer.scala
@@ -48,6 +48,10 @@ final class ListBuffer[A]
// Implementations of abstract methods in Buffer
+ override def apply(n: Int): A =
+ if (n < 0 || n >= len) throw new IndexOutOfBoundsException(n.toString())
+ else super.apply(n)
+
/** Replaces element at index <code>n</code> with the new element
* <code>newelem</code>. Takes time linear in the buffer size. (except the
* first element, which is updated in constant time).
@@ -230,7 +234,7 @@ final class ListBuffer[A]
* @pre an element exists at position <code>n</code>
* @throws Predef.IndexOutOfBoundsException if <code>n</code> is out of bounds.
*/
- def remove(n: Int): A = try {
+ def remove(n: Int): A = {
if (n < 0 || n >= len) throw new IndexOutOfBoundsException(n.toString())
if (exported) copy()
var old = start.head