summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/mutable/Map.scala
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2011-01-10 10:47:26 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2011-01-10 10:47:26 +0000
commit5b481bbff7e7cc68f241fb4dc3c6bddb66108940 (patch)
tree10274ea8070e1c8b9dab86356fe6d3c0615ceca3 /src/library/scala/collection/mutable/Map.scala
parentbc55c7854ca96ced47aa05ca85039df28fe61509 (diff)
downloadscala-5b481bbff7e7cc68f241fb4dc3c6bddb66108940.tar.gz
scala-5b481bbff7e7cc68f241fb4dc3c6bddb66108940.tar.bz2
scala-5b481bbff7e7cc68f241fb4dc3c6bddb66108940.zip
Added comments for #4008.
No review.
Diffstat (limited to 'src/library/scala/collection/mutable/Map.scala')
-rw-r--r--src/library/scala/collection/mutable/Map.scala16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala
index 5df8594a16..e30a5a4f64 100644
--- a/src/library/scala/collection/mutable/Map.scala
+++ b/src/library/scala/collection/mutable/Map.scala
@@ -26,10 +26,22 @@ trait Map[A, B]
override def empty: Map[A, B] = Map.empty
- /** The same map with a given default function */
+ /** The same map with a given default function.
+ *
+ * Invoking transformer methods (e.g. `map`) will not preserve the default value.
+ *
+ * @param d the function mapping keys to values, used for non-present keys
+ * @return a wrapper of the map with a default value
+ */
def withDefault(d: A => B): mutable.Map[A, B] = new Map.WithDefault[A, B](this, d)
- /** The same map with a given default value */
+ /** The same map with a given default value.
+ *
+ * Invoking transformer methods (e.g. `map`) will not preserve the default value.
+ *
+ * @param d the function mapping keys to values, used for non-present keys
+ * @return a wrapper of the map with a default value
+ */
def withDefaultValue(d: B): mutable.Map[A, B] = new Map.WithDefault[A, B](this, x => d)
/** Return a read-only projection of this map. !!! or just use an (immutable) MapProxy?