diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-05-16 04:47:03 -0700 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-05-16 04:47:03 -0700 |
commit | e0e1ac5f66caf011ccc27ea993653fc4f87f726b (patch) | |
tree | 6d92b10b353888774304ca71d31229a7d0fd2c75 | |
parent | 70cac53e2532979be206ef9d6c0f7d4406d9ec7d (diff) | |
parent | cb7655df50df7a8c14848687ee43a5a69ad802dc (diff) | |
download | scala-e0e1ac5f66caf011ccc27ea993653fc4f87f726b.tar.gz scala-e0e1ac5f66caf011ccc27ea993653fc4f87f726b.tar.bz2 scala-e0e1ac5f66caf011ccc27ea993653fc4f87f726b.zip |
Merge pull request #555 from srp/master
mutable.MapLike: override $mapNote to reflect actual require mutable api
-rw-r--r-- | src/library/scala/collection/mutable/MapLike.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/library/scala/collection/mutable/MapLike.scala b/src/library/scala/collection/mutable/MapLike.scala index b8b1152099..3046207533 100644 --- a/src/library/scala/collection/mutable/MapLike.scala +++ b/src/library/scala/collection/mutable/MapLike.scala @@ -18,6 +18,28 @@ import parallel.mutable.ParMap * $mapNote * $mapTags * @since 2.8 + * + * @define mapNote + * '''Implementation note:''' + * This trait provides most of the operations of a mutable `Map` + * independently of its representation. It is typically inherited by + * concrete implementations of maps. + * + * To implement a concrete mutable map, you need to provide + * implementations of the following methods: + * {{{ + * def get(key: A): Option[B] + * def iterator: Iterator[(A, B)] + * def += (kv: (A, B)): This + * def -= (key: A): This + * }}} + * If you wish that methods like `take`, `drop`, `filter` also return the same kind of map + * you should also override: + * {{{ + * def empty: This + * }}} + * It is also good idea to override methods `foreach` and + * `size` for efficiency. */ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]] extends scala.collection.MapLike[A, B, This] |