Scala Library Documentation
|
|
scala/collection/mutable/Map.scala
]
trait
Map[A, B]
extends
Map[A, B] with
Scriptable[Message[(A, B)]]scala.collection.Map
as well as for update
,
and -=
.Method Summary | |
def
|
+
(kv1 : (A, B), kv2 : (A, B), kvs : (A, B)*) : Map[A, B]
Add two or more key/value pairs to this map.
|
def
|
+
(kv : (A, B)) : Map[A, B]
Add a key/value pair to this map.
|
def
|
++
(kvs : Iterator[(A, B)]) : Map[A, B]
Add a sequence of key/value pairs to this map.
|
def
|
++
(kvs : Iterable[(A, B)]) : Map[A, B]
Add a sequence of key/value pairs to this map.
|
def
|
++=
(kvs : Iterable[(A, B)]) : Unit
Add a sequence of key/value pairs to this map.
|
def
|
++=
(kvs : Iterator[(A, B)]) : Unit
Add a sequence of key/value pairs to this map.
|
def
|
+=
(kv1 : (A, B), kv2 : (A, B), kvs : (A, B)*) : Unit
Add two or more key/value pairs to this map.
|
def
|
+=
(key : A) : MapTo
This method defines syntactic sugar for adding or modifying
mappings. It is typically used in the following way:
map += key -> value; |
def
|
+=
(kv : (A, B)) : Unit
Add a key/value pair to this map.
|
def
|
-
(key1 : A, key2 : A, keys : A*) : Map[A, B]
Remove two or more keys from this map
|
def
|
-
(key : A) : Map[A, B]
Remove a key from this map
|
def
|
--
(keys : Iterator[A]) : Map[A, B]
Remove a sequence of keys from this map
|
def
|
--
(keys : Iterable[A]) : Map[A, B]
Remove a sequence of keys from this map
|
def
|
--=
(keys : Iterator[A]) : Unit
Remove a sequence of keys from this map
|
def
|
--=
(keys : Iterable[A]) : Unit
Remove a sequence of keys from this map
|
abstract def
|
-=
(key : A) : Unit
Remove a key from this map, noop if key is not present.
|
def
|
-=
(key1 : A, key2 : A, keys : A*) : Unit
Remove two or more keys from this map
|
def
|
<<
(cmd : Message[(A, B)]) : Unit
Send a message to this scriptable object.
|
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.
|
def
|
excl
(keys : A*) : Unit
This method will remove all the mappings for the given sequence
of keys from the map.
|
def
|
getOrElseUpdate
(key : A, default : => B) : B
Check if this map maps
key to a value.
Return that value if it exists, otherwise put default
as that key's value and return it. |
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. |
def
|
retain
(p : (A, B) => Boolean) : Unit
This method retains only those mappings for which the predicate
p returns true . |
def
|
transform
(f : (A, B) => B) : Unit
This function transforms all the values of mappings contained
in this map with function
f . |
abstract 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. |
Methods inherited from Map | |
size (abstract), get (abstract), getOrElse, isEmpty, apply, contains, isDefinedAt, keys, keySet, values, equals, hashCode, toString, default, projection |
Methods inherited from Collection | |
toArray, stringPrefix |
Methods inherited from Iterable | |
elements (abstract), concat, ++, map, flatMap, filter, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, 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 |
Class Summary | |
class
|
MapTo
(key : A) extends AnyRef
|
Method Details |
key
to value
to the map. If the map already contains a
mapping for key
, it will be overridden by this
function.key -
The key to updatevalue -
The new valuekv -
the key/value pair.kv1 -
the first key/value pair.kv2 -
the second key/value pair.kvs -
the remaining key/value pairs.kvs -
the iterable object containing all key/value pairs.kvs -
the iterator containing all key/value pairs.kv -
the key/value pair.kv1 -
the first key/value pair.kv2 -
the second key/value pair.kvs -
the remaining key/value pairs.kvs -
the iterable object containing all key/value pairs.kvs -
the iterator containing all key/value pairs.key -
the key to be removedkey1 -
the first key to be removedkey2 -
the second key to be removedkeys -
the remaining keys to be removedkeys -
the keys to be removedkeys -
the keys to be removedkey -
the key to be removedkey
removed if it existed.key1 -
the first key to be removedkey2 -
the second key to be removedkeys -
the remaining keys to be removedkeys -
the keys to be removedkeys
removed.keys -
the keys to be removedkeys
removed.
def
clear : Unit
key
to a value.
Return that value if it exists, otherwise put default
as that key's value and return it.f
.f -
The transformation to applyp
returns true
.p -
The test predicatecmd -
the message to send.
def
+=(key : A) : MapTo
map += key -> value;
+={key, value}
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.mappings -
+=
def
excl(keys : A*) : Unit
keys -
-=
Scala Library Documentation
|
|