scala.collection.mutable
trait SynchronizedMap

[source: `scala/collection/mutable/SynchronizedMap.scala`]

`` `trait` SynchronizedMap[A, B]
  `extends` Map[A, B]

  This class should be used as a mixin. It synchronizes the `Map` functions of the class into which it is mixed in.

Author
  Matthias Zenger, Martin Odersky
Version
  2.0, 31/12/2006

Method Summary
`override def` | ++= (it : Iterator[(A, B)]) : Unit Add a sequence of key/value pairs to this map.
`override def` | ++= (map : Iterable[(A, B)]) : Unit Add a sequence of key/value pairs to this map.
`override def` | += (kv1 : (A, B), kv2 : (A, B), kvs : (A, B)*) : Unit Add two or more key/value pairs to this map.
`override def` | += (kv : (A, B)) : Unit Add a key/value pair to this map.
`override def` | --= (keys : Iterable[A]) : Unit Remove a sequence of keys from this map
`override def` | --= (it : Iterator[A]) : Unit Remove a sequence of keys from this map
`override def` | -= (key1 : A, key2 : A, keys : A*) : Unit Remove two or more keys from this map
`def` | -= (key : A) : Unit Remove a key from this map, noop if key is not present.
`override def` | << (cmd : Message[(A, B)]) : Unit Send a message to this scriptable object.
`override def` | apply (key : A) : B Retrieve the value which is associated with the given key. This method throws an exception if there is no mapping from the given key to a value.
`override def` | clear : Unit Removes all mappings from the map. After this operation is completed, the map is empty.
`override def` | clone : Map[A, B] Return a clone of this map.
`override def` | contains (key : A) : Boolean Is the given key mapped to a value by this map?
`def` | elements : Iterator[(A, B)] Creates a new iterator over all elements contained in this object.
`override def` | equals (that : Any) : Boolean Compares two maps structurally; i.e. checks if all mappings contained in this map are also contained in the other map, and vice versa.
`override def` | excl (keys : A*) : Unit This method will remove all the mappings for the given sequence of keys from the map.
`def` | get (key : A) : Option[B] Check if this map maps `key` to a value and return the value if it exists.
`override def` | hashCode : Int A hash method compatible with `equals`
`override def` | incl (mappings : (A, B)*) : Unit `incl` can be used to add many mappings at the same time to the map. The method assumes that a mapping is represented by a `Pair` object who's first component denotes the key, and who's second component refers to the value.
`override def` | isDefinedAt (key : A) : Boolean Does this map contain a mapping from the given key to a value?
`override def` | isEmpty : Boolean Is this an empty map?
`override def` | keySet : Set[A]
`override def` | keys : Iterator[A] Creates an iterator for all keys.
`override def` | retain (p : (A, B) => Boolean) : Unit This method retains only those mappings for which the predicate `p` returns `true`.
`def` | size : Int Compute the number of key-to-value mappings.
`override def` | toList : List[(A, B)] Create a fresh list with all the elements of this iterable object.
`override def` | toString : String Creates a string representation for this map.
`override def` | transform (f : (A, B) => B) : Unit This function transforms all the values of mappings contained in this map with function `f`.
`def` | update (key : A, value : B) : Unit This method allows one to add a new mapping from `key` to `value` to the map. If the map already contains a mapping for `key`, it will be overridden by this function.
`override def` | values : Iterator[B] Creates an iterator for a contained values.

Methods inherited from Map
+, +, ++, ++, -, -, --, --, getOrElseUpdate, +=

Methods inherited from Map
getOrElse, default, projection

Methods inherited from Collection
toArray, stringPrefix

Methods inherited from Iterable
concat, ++, map, flatMap, filter, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, mkString, mkString, addString, addString, copyToArray, hasDefiniteSize

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` size : Int

  Compute the number of key-to-value mappings.

Returns
  the number of mappings

`` `def` get(key : A) : Option[B]

  Check if this map maps `key` to a value and return the value if it exists.

Parameters
  `key -` the key of the mapping of interest
Returns
  the value of the mapping, if it exists

`override` `def` isEmpty : Boolean

  Is this an empty map?

Returns
  `true` iff the map is empty.

`override` `def` apply(key : A) : B

  Retrieve the value which is associated with the given key. This method throws an exception if there is no mapping from the given key to a value.

Parameters
  `key -` the key
Returns
  the value associated with the given key.

`override` `def` contains(key : A) : Boolean

  Is the given key mapped to a value by this map?

Parameters
  `key -` the key
Returns
  `true` iff there is a mapping for key in this map

`override` `def` isDefinedAt(key : A) : Boolean

  Does this map contain a mapping from the given key to a value?

Parameters
  `key -` the key
Returns
  `true` iff there is a mapping for key in this map

`override` `def` keys : Iterator[A]

  Creates an iterator for all keys.

Returns
  an iterator over all keys.

`override` `def` keySet : Set[A]

Returns
  the keys of this map as a set.

`override` `def` values : Iterator[B]

  Creates an iterator for a contained values.

Returns
  an iterator over all values.

`` `def` elements : Iterator[(A, B)]

  Creates a new iterator over all elements contained in this object.

Returns
  the new iterator

`override` `def` toList : List[(A, B)]

  Create a fresh list with all the elements of this iterable object.

Notes
  Will not terminate for infinite-sized collections.

`` `def` update(key : A, value : B) : Unit

  This method allows one to add a new mapping from `key` to `value` to the map. If the map already contains a mapping for `key`, it will be overridden by this function.

Parameters
  `key -` The key to update
  `value -` The new value

Overrides
  Map.update

`override` `def` +=(kv : (A, B)) : Unit

  Add a key/value pair to this map.

Parameters
  `kv -` the key/value pair.

Overrides
  Map.+=

`override` `def` +=(kv1 : (A, B), kv2 : (A, B), kvs : (A, B)*) : Unit

  Add two or more key/value pairs to this map.

Parameters
  `kv1 -` the key/first value pair.
  `kv2 -` the second key/first value pair.
  `kvs -` the remaining key/first value pairs.

Overrides
  Map.+=

`override` `def` ++=(map : Iterable[(A, B)]) : Unit

  Add a sequence of key/value pairs to this map.

Parameters
  `kvs -` the iterable object containing all key/value pairs.

Overrides
  Map.++=

`override` `def` ++=(it : Iterator[(A, B)]) : Unit

  Add a sequence of key/value pairs to this map.

Parameters
  `kvs -` the iterator containing all key/value pairs.

Overrides
  Map.++=

@deprecated
`override` `def` incl(mappings : (A, B)*) : Unit

  `incl` can be used to add many mappings at the same time to the map. The method assumes that a mapping is represented by a `Pair` object who's first component denotes the key, and who's second component refers to the value.

Parameters
  `mappings -`
Deprecated
  use `+=`

Overrides
  Map.incl

`` `def` -=(key : A) : Unit

  Remove a key from this map, noop if key is not present.

Parameters
  `key -` the key to be removed

Overrides
  Map.-=

`override` `def` -=(key1 : A, key2 : A, keys : A*) : Unit

  Remove two or more keys from this map

Parameters
  `key1 -` the first key to be removed
  `key2 -` the second key to be removed
  `keys -` the remaining keys to be removed

Overrides
  Map.-=

`override` `def` --=(keys : Iterable[A]) : Unit

  Remove a sequence of keys from this map

Parameters
  `keys -` the keys to be removed

Overrides
  Map.--=

`override` `def` --=(it : Iterator[A]) : Unit

  Remove a sequence of keys from this map

Parameters
  `keys -` the keys to be removed

Overrides
  Map.--=

@deprecated
`override` `def` excl(keys : A*) : Unit

  This method will remove all the mappings for the given sequence of keys from the map.

Parameters
  `keys -`
Deprecated
  use `-=`

Overrides
  Map.excl

`override` `def` clear : Unit

  Removes all mappings from the map. After this operation is completed, the map is empty.

Overrides
  Map.clear

`override` `def` transform(f : (A, B) => B) : Unit

  This function transforms all the values of mappings contained in this map with function `f`.

Parameters
  `f -` The transformation to apply

Overrides
  Map.transform

`override` `def` retain(p : (A, B) => Boolean) : Unit

  This method retains only those mappings for which the predicate `p` returns `true`.

Parameters
  `p -` The test predicate

Overrides
  Map.retain

`override` `def` toString : String

  Creates a string representation for this map.

Returns
  a string showing all mappings

`override` `def` equals(that : Any) : Boolean

  Compares two maps structurally; i.e. checks if all mappings contained in this map are also contained in the other map, and vice versa.

Parameters
  `that -` the other map
Returns
  `true` iff both maps contain exactly the same mappings.

`override` `def` hashCode : Int

  A hash method compatible with `equals`

`override` `def` <<(cmd : Message[(A, B)]) : Unit

  Send a message to this scriptable object.

Parameters
  `cmd -` the message to send.

Overrides
  Map.<<

`override` `def` clone : Map[A, B]

  Return a clone of this map.

Returns
  a map with the same elements.

Overrides
  Map.clone