|
Scala 2.3.0
|
abstract
trait
Map
[A, B]
extends
java.lang.Object
with
scala.PartialFunction[A, B]
with
scala.Iterable[scala.Tuple2[A, B]]
with
scala.ScalaObject
Map
may only be used for accessing elements from map
implementations. Two different extensions of class Map
in
the package
scala.collection.mutable
and
scala.collection.immutable
provide functionality for
adding new key/value mappings to a map. The class in the first package is
implemented by maps that are modified destructively, whereas the class in
the second package is used by functional map implementations that rely on
immutable data structures.Def Summary | |
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. |
|
def
contains
(key: A)
: scala.Boolean
Is the given key mapped to a value by this map? |
|
def
default
(key: A)
: B
The default value for the map, returned when a key is not found The method implemented here yields an error, but it might be overridden in subclasses. |
|
override
|
def
equals
(that: scala.Any)
: scala.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. |
abstract
|
def
get
(key: A)
: scala.Option[B]
Check if this map maps key to a value and return the
value if it exists.
|
def
isDefinedAt
(key: A)
: scala.Boolean
Does this map contain a mapping from the given key to a value? |
|
def
isEmpty
: scala.Boolean
Is this an empty map? |
|
def
keys
: scala.Iterator[A]
Creates an iterator for all keys. |
|
abstract
|
def
size
: scala.Int
Compute the number of key-to-value mappings. |
override
|
def
toString
: java.lang.String
Creates a string representation for this map. |
def
values
: scala.Iterator[B]
Creates an iterator for a contained values. |
Def inherited from scala.PartialFunction[A, B] | |
andThen , isDefinedAt, orElse |
Def inherited from scala.Iterable[scala.Tuple2[A, B]] | |
/: , :\, concat, elements, exists, find, findIndexOf, foldLeft, foldRight, forall, foreach, indexOf, sameElements, toList |
Def Detail |
key -
the key
def
contains
(key: A): scala.Boolean
key -
the key
true
iff there is a mapping for key in this map
key -
...
Predef.NoSuchElementException -
...
override
def
equals
(that: scala.Any): scala.Boolean
that -
the other map
true
iff both maps contain exactly the same mappings.
abstract
def
get
(key: A): scala.Option[B]
key
to a value and return the
value if it exists.key -
the key of the mapping of interest
def
isDefinedAt
(key: A): scala.Boolean
key -
the key
true
iff there is a mapping for key in this map
def
isEmpty
: scala.Boolean
true
iff the map is empty.
def
keys
: scala.Iterator[A]
abstract
def
size
: scala.Int
override
def
toString
: java.lang.String
def
values
: scala.Iterator[B]