summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/Map.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2009-11-03 10:37:56 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2009-11-03 10:37:56 +0000
commit094ed77bd98bbdd22fa8fee4a3e5c3dc0118dc2b (patch)
treedaada3340bcd5735713fc68cc3648107f7f8646e /src/library/scala/collection/Map.scala
parent3d115bd2a4191c28e6d8a9c2633740288479cec7 (diff)
downloadscala-094ed77bd98bbdd22fa8fee4a3e5c3dc0118dc2b.tar.gz
scala-094ed77bd98bbdd22fa8fee4a3e5c3dc0118dc2b.tar.bz2
scala-094ed77bd98bbdd22fa8fee4a3e5c3dc0118dc2b.zip
fixed #2500: refactoring collections so that a ...
fixed #2500: refactoring collections so that a `collection.{Map|SortedMap|SortedSet}` can be built from the corresponding collection (thus, do not require the immutable one) pulling up newBuilder method from Immutable*Factory to *Factory, and inheriting *Factory in scala.collection companion objects, instead of the Immutable*Factory this way, you can, e.g., build a collection.Map from a collection.Map (instead of requiring an immutable.Map)
Diffstat (limited to 'src/library/scala/collection/Map.scala')
-rw-r--r--src/library/scala/collection/Map.scala7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/library/scala/collection/Map.scala b/src/library/scala/collection/Map.scala
index b53786308b..f947e4e5da 100644
--- a/src/library/scala/collection/Map.scala
+++ b/src/library/scala/collection/Map.scala
@@ -35,7 +35,7 @@ import generic._
* @note If you do not have specific implementations for `add` and `-` in mind,
* you might consider inheriting from <code>DefaultMap</code> instead.
*
- * @note Of you additions and mutations return the same kind of map as the map
+ * @note If your additions and mutations return the same kind of map as the map
* you are defining, you should inherit from <code>MapLike</code> as well.
*
* @since 1
@@ -48,7 +48,8 @@ trait Map[A, +B] extends Iterable[(A, B)] with MapLike[A, B, Map[A, B]] {
*
* @since 2.5
*/
-object Map extends ImmutableMapFactory[immutable.Map] {
- def empty[A, B]: immutable.Map[A, B] = immutable.Map.empty
+object Map extends MapFactory[Map] {
+ def empty[A, B]: Map[A, B] = immutable.Map.empty
+
implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), Map[A, B]] = new MapCanBuildFrom[A, B]
}