summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/mutable/MapLike.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-12-07 18:17:48 +0000
committerPaul Phillips <paulp@improving.org>2009-12-07 18:17:48 +0000
commit873a28d90c6215d91bc024ba124d11030dc77596 (patch)
tree5638c1f6d5a182b1fcc870d1b3696df6e0f7f532 /src/library/scala/collection/mutable/MapLike.scala
parent1e88594f358d08b5e9b22ba87280003a581359e4 (diff)
downloadscala-873a28d90c6215d91bc024ba124d11030dc77596.tar.gz
scala-873a28d90c6215d91bc024ba124d11030dc77596.tar.bz2
scala-873a28d90c6215d91bc024ba124d11030dc77596.zip
Re-deleted a method which snuck back in on the ...
Re-deleted a method which snuck back in on the last commit.
Diffstat (limited to 'src/library/scala/collection/mutable/MapLike.scala')
-rw-r--r--src/library/scala/collection/mutable/MapLike.scala21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/library/scala/collection/mutable/MapLike.scala b/src/library/scala/collection/mutable/MapLike.scala
index 92f1b5bba6..a1e8e9b6d6 100644
--- a/src/library/scala/collection/mutable/MapLike.scala
+++ b/src/library/scala/collection/mutable/MapLike.scala
@@ -103,15 +103,6 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
*/
override def updated[B1 >: B](key: A, value: B1): mutable.Map[A, B1] = this + ((key, value))
- /** If given key is already in this map, returns associated value
- * Otherwise, computes value from given expression `op`, stores with key
- * in map and returns that value.
- */
- def cached(key: A, op: => B) = get(key) match {
- case Some(v) => v
- case None => val v = op; update(key, v); v
- }
-
/** Add a new key/value mapping and return the map itself.
*
* @param kv the key/value mapping to be added
@@ -193,14 +184,14 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
*/
def clear() { for ((k, v) <- this.iterator) -=(k) }
- /** 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 =
+ /** If given key is already in this map, returns associated value
+ * Otherwise, computes value from given expression `op`, stores with key
+ * in map and returns that value.
+ */
+ def getOrElseUpdate(key: A, op: => B): B =
get(key) match {
case Some(v) => v
- case None => val d = default; this(key) = d; d
+ case None => val d = op; this(key) = d; d
}
/** This function transforms all the values of mappings contained