From 0b43b2e82dcfe2489573955f73202c3e2a54b1ca Mon Sep 17 00:00:00 2001 From: mihaylov Date: Wed, 17 Mar 2004 13:16:51 +0000 Subject: - Explicitly import java.lang.System.arraycopy ... - Explicitly import java.lang.System.arraycopy to avoid name clash with mscorlib's System namespace. --- sources/scala/collection/mutable/ArrayBuffer.scala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sources') diff --git a/sources/scala/collection/mutable/ArrayBuffer.scala b/sources/scala/collection/mutable/ArrayBuffer.scala index 9f95a65ee7..98c10852e8 100644 --- a/sources/scala/collection/mutable/ArrayBuffer.scala +++ b/sources/scala/collection/mutable/ArrayBuffer.scala @@ -17,6 +17,7 @@ package scala.collection.mutable; * @version 1.0, 15/03/2004 */ class ArrayBuffer[A] extends Buffer[A] { + import java.lang.System.arraycopy; protected def initialCapacity: Int = 8; @@ -35,7 +36,7 @@ class ArrayBuffer[A] extends Buffer[A] { protected def ensureCapacity(n: Int): Unit = { if ((size + n) >= buf.length) { val newbuf: Array[A] = new Array(buf.length * 2); - System.arraycopy(buf, 0, newbuf, 0, size); + arraycopy(buf, 0, newbuf, 0, size); buf = newbuf; } } @@ -67,7 +68,7 @@ class ArrayBuffer[A] extends Buffer[A] { */ def +:(elem: A): Buffer[A] = { ensureCapacity(1); - System.arraycopy(buf, 0, buf, 1, size); + arraycopy(buf, 0, buf, 1, size); buf(0) = elem; size = size + 1; this @@ -94,7 +95,7 @@ class ArrayBuffer[A] extends Buffer[A] { val xs = iter.elements.toList; val len = xs.length; ensureCapacity(len); - System.arraycopy(buf, n, buf, n + len, size - n); + arraycopy(buf, n, buf, n + len, size - n); xs.copyToArray(buf, n); size = size + len; } @@ -123,7 +124,7 @@ class ArrayBuffer[A] extends Buffer[A] { if ((n < 0) || (n >= size)) error("cannot remove element " + n + " in Buffer"); val res = buf(n); - System.arraycopy(buf, n + 1, buf, n, size - n - 1); + arraycopy(buf, n + 1, buf, n, size - n - 1); size = size - 1; res } -- cgit v1.2.3