summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2007-05-01 11:47:56 +0000
committermihaylov <mihaylov@epfl.ch>2007-05-01 11:47:56 +0000
commit86e18d84dc41c3064734ff866072a9c71475939c (patch)
tree807efcb5e7775a99262433368b3e3ccae9c6f728 /src/library
parentcf626598eabab3f238f255af162e3f71a6a18d2e (diff)
downloadscala-86e18d84dc41c3064734ff866072a9c71475939c.tar.gz
scala-86e18d84dc41c3064734ff866072a9c71475939c.tar.bz2
scala-86e18d84dc41c3064734ff866072a9c71475939c.zip
Made mutable.{Set, BitSet} platform-independent
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/collection/mutable/BitSet.scala4
-rw-r--r--src/library/scala/collection/mutable/Set.scala4
-rw-r--r--src/library/scala/compat/Platform.scala3
3 files changed, 8 insertions, 3 deletions
diff --git a/src/library/scala/collection/mutable/BitSet.scala b/src/library/scala/collection/mutable/BitSet.scala
index 455d8e3687..fdf1df2454 100644
--- a/src/library/scala/collection/mutable/BitSet.scala
+++ b/src/library/scala/collection/mutable/BitSet.scala
@@ -24,7 +24,7 @@ package scala.collection.mutable
@serializable
class BitSet(initSize: Int) extends collection.BitSet with Set[Int] {
- import compat.Platform.arraycopy
+ import compat.Platform.{arraycopy, arrayclear}
/** default constructor, initial size of 512 bits. */
def this() = this(0)
@@ -78,7 +78,7 @@ class BitSet(initSize: Int) extends collection.BitSet with Set[Int] {
/** Clears all bits of the set.
*/
override def clear(): Unit = {
- java.util.Arrays.fill(arr, 0)
+ arrayclear(arr)
size = 0
}
diff --git a/src/library/scala/collection/mutable/Set.scala b/src/library/scala/collection/mutable/Set.scala
index 8e081191b6..faa712edf8 100644
--- a/src/library/scala/collection/mutable/Set.scala
+++ b/src/library/scala/collection/mutable/Set.scala
@@ -12,6 +12,8 @@
package scala.collection.mutable
+import compat.Platform.ConcurrentModificationException
+
/** The canonical factory methods for <a href="Set.html">mutable sets</a>.
* Currently these return <a href="HashSet.html">HashSet's</a>.
*/
@@ -209,7 +211,7 @@ trait Set[A] extends collection.Set[A] with Scriptable[Message[A]] {
override val hashCode = Set.this.hashCode
private def check =
if (false && hashCode != Set.this.hashCode)
- throw new java.util.ConcurrentModificationException
+ throw new ConcurrentModificationException
def contains(item : A) = {
check
diff --git a/src/library/scala/compat/Platform.scala b/src/library/scala/compat/Platform.scala
index 724102794e..7d0cec4b72 100644
--- a/src/library/scala/compat/Platform.scala
+++ b/src/library/scala/compat/Platform.scala
@@ -18,6 +18,7 @@ import Predef._
object Platform {
type StackOverflowError = java.lang.StackOverflowError
+ type ConcurrentModificationException = java.util.ConcurrentModificationException
/**
* @param src ..
@@ -39,6 +40,8 @@ object Platform {
def createArray(elemClass: Class, length: Int): AnyRef =
java.lang.reflect.Array.newInstance(elemClass, length)
+ def arrayclear(arr: Array[Int]): Unit = java.util.Arrays.fill(arr, 0)
+
def getClassForName(name: String): Class = java.lang.Class.forName(name)
val EOL = System.getProperty("line.separator", "\n")