summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library/scala/collection/mutable/Map.scala18
-rw-r--r--src/library/scala/collection/mutable/Set.scala17
2 files changed, 17 insertions, 18 deletions
diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala
index 807ce14d90..ca1dd9d62e 100644
--- a/src/library/scala/collection/mutable/Map.scala
+++ b/src/library/scala/collection/mutable/Map.scala
@@ -13,12 +13,10 @@ package scala.collection.mutable
import Predef._
-//import Predef.UnsupportedOperationException
-
-/** The canonical factory methods for <a href="Map.html">mutable maps</a>. These currently
- * return <a href="HashMap.html">HashMap's</a>.
- */
+/** The canonical factory methods for <a href="Map.html">mutable maps</a>.
+ * These currently return <a href="HashMap.html">HashMap's</a>.
+ */
object Map {
/** The empty map of this type; this is implemented as a hashtable */
@@ -158,13 +156,13 @@ trait Map[A, B] extends AnyRef
/** Removes all mappings from the map. After this operation is
* completed, the map is empty.
*/
- def clear(): Unit = keys foreach -=
+ def clear() { keys foreach -= }
/** Check if this map maps <code>key</code> to a value.
* Return that value if it exists, otherwise put <code>default</code>
* as that key's value and return it.
*/
- def getOrElseUpdate(key: A, default: =>B): B =
+ def getOrElseUpdate(key: A, default: => B): B =
get(key) match {
case Some(v) => v
case None => val d = default; this(key) = d; d
@@ -228,7 +226,7 @@ trait Map[A, B] extends AnyRef
* @deprecated use <code>+=</code>
*/
@deprecated
- def incl(mappings: (A, B)*): Unit = this ++= mappings.elements
+ def incl(mappings: (A, B)*) { this ++= mappings.elements }
/** This method will remove all the mappings for the given sequence
* of keys from the map.
@@ -237,11 +235,11 @@ trait Map[A, B] extends AnyRef
* @deprecated use <code>-=</code>
*/
@deprecated
- def excl(keys: A*): Unit = this --= keys.elements
+ def excl(keys: A*) { this --= keys.elements }
@deprecated
class MapTo(key: A) {
- def ->(value: B): Unit = update(key, value)
+ def ->(value: B) { update(key, value) }
}
}
diff --git a/src/library/scala/collection/mutable/Set.scala b/src/library/scala/collection/mutable/Set.scala
index 077e018e6f..d3445a56d6 100644
--- a/src/library/scala/collection/mutable/Set.scala
+++ b/src/library/scala/collection/mutable/Set.scala
@@ -11,12 +11,12 @@
package scala.collection.mutable
+import Predef._
-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>.
- */
+ * Currently these return <a href="HashSet.html">HashSet's</a>.
+ */
object Set {
/** The empty map of this type; this is implemented as a hashtable */
@@ -45,8 +45,9 @@ trait Set[A] extends collection.Set[A] with Scriptable[Message[A]] with Cloneabl
* <pre>set(elem) = true</pre>
*
*/
- def update(elem: A, included: Boolean): Unit =
+ def update(elem: A, included: Boolean) {
if (included) this += elem else this -= elem
+ }
/** Add a new element to the set.
*
@@ -71,7 +72,7 @@ trait Set[A] extends collection.Set[A] with Scriptable[Message[A]] with Cloneabl
* <code>elems</code> to the set.
* @param elems the iterator containing the elements to be added
*/
- def ++=(elems: Iterator[A]): Unit = elems foreach +=
+ def ++=(elems: Iterator[A]) { elems foreach += }
/** Add a new element to the set.
* @return the set itself with the element added.
@@ -129,7 +130,7 @@ trait Set[A] extends collection.Set[A] with Scriptable[Message[A]] with Cloneabl
/** Remove all the elements provided by an iterator
* <code>elems</code> from the set.
*/
- def --=(elems: Iterator[A]): Unit = elems foreach -=
+ def --=(elems: Iterator[A]) { elems foreach -= }
/** Remove a new element from the set.
* @return the set itself with the element removed.
@@ -171,7 +172,7 @@ trait Set[A] extends collection.Set[A] with Scriptable[Message[A]] with Cloneabl
*
* @param that the set to intersect with.
*/
- def intersect(that: Set[A]): Unit = retain(that.contains)
+ def intersect(that: Set[A]) { retain(that.contains) }
/** Method <code>retain removes all elements from the set for
* which the predicate <code>p</code> yields the value <code>false</code>.
@@ -183,7 +184,7 @@ trait Set[A] extends collection.Set[A] with Scriptable[Message[A]] with Cloneabl
/** Removes all elements from the set. After this operation is completed,
* the set will be empty.
*/
- def clear(): Unit = elements foreach -=
+ def clear() { elements foreach -= }
/** Send a message to this scriptable object.
*