scala.collection.mutable

trait MapLikeBase

[source: scala/collection/mutable/MapLikeBase.scala]

trait MapLikeBase[A, B, +This <: MapLikeBase[A, B, This] with Map[A, B]]
extends MapLike[A, B, This] with Cloneable[This]
The reason for this class is so that we can have both a generic immutable `+` with signature def + [B1 >: B](kv: (A, B1)): Map[A, B1] and a (deprecated) mutable `+` of signature def + (kv: (A, B)): this.type = this += kv The former is required to fulfill the Map contract. The latter is required for backwards compatibility. We can't have both methods in the same class, as that would give a double definition. They are OK in different classes though, and narrowly escape a `same erasure' problem. Once the deprecated + goes away we can do without class MapLikeBase.
Author
Martin Odersky
Version
2.8
Since
2.8
Direct Known Subclasses:
MapLike

Method Summary
def + [B1 >: B](kv : (A, B1)) : Map[A, B1]
Add a key/value pair to this map, returning a new map.
Methods inherited from Cloneable
clone
Methods inherited from MapLike
empty (abstract), get (abstract), iterator (abstract), - (abstract), newBuilder, isEmpty, getOrElse, apply, contains, isDefinedAt, keySet, keysIterator, keys, valuesIterable, valuesIterator, values, default, filterKeys, mapValues, mapElements, updated, +, ++, ++, addString, stringPrefix, toString, hashCode, equals
Methods inherited from Subtractable
-, --, --
Methods inherited from IterableLike
thisCollection, toCollection, elements, foreach, forall, exists, find, foldRight, reduceRight, toIterable, head, take, slice, takeWhile, takeRight, dropRight, copyToArray, zip, zipAll, zipWithIndex, sameElements, toStream, canEqual, view, view, first, firstOption, projection
Methods inherited from TraversableLike
repr, nonEmpty, size, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, count, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, tail, last, lastOption, init, drop, dropWhile, span, splitAt, copyToBuffer, copyToArray, toArray, toList, toSeq, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, withFilter
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from AnyRef
getClass, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
def +[B1 >: B](kv : (A, B1)) : Map[A, B1]
Add a key/value pair to this map, returning a new map.
Parameters
kv - the key/value pair
Returns
A new map with the new binding added to this map
Overrides
MapLike.+