|
Scala 2.1.7patch8283
|
class
Map
[ A , B ]
extends
java.lang.Object with
scala.PartialFunction[A,B] with
scala.Iterable[scala.Tuple2[A,B]] with
scala.ScalaObjectMap
may only be used for
accessing elements from map implementations. Two different extensions
of class Map
in the package scala.collections.mutable
and scala.collections.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. |
def
exists
( p : (A, B) => scala.Boolean )
: scala.Boolean
Applies the given predicate to all (key, value) mappings contained in this map and returns true if there is at least one mapping for which this predicate yields true. |
|
def
forall
( p : (A, B) => scala.Boolean )
: scala.Boolean
Applies the given predicate to all (key, value) mappings contained in this map and returns true if this predicate yields true for all mappings. |
|
def
foreach
( f : (A, B) => scala.Unit )
: scala.Unit
Executes the given function for all (key, value) pairs contained in this map. |
|
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. |
|
def
size
: scala.Int
Compute the number of key-to-value mappings. |
|
def
toList
: scala.List[scala.Tuple2[A,B]]
Returns the mappings of this map as a list. |
|
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 Detail |
def
apply
( key : A ) : B
def
contains
( key : A ) : scala.Boolean
def
default
( key : A ) : B
def
equals
( that : scala.Any ) : scala.Boolean
def
exists
( p : (A, B) => scala.Boolean ) : scala.Boolean
def
forall
( p : (A, B) => scala.Boolean ) : scala.Boolean
def
foreach
( f : (A, B) => scala.Unit ) : scala.Unit
def
get
( key : A ) : scala.Option[B]
key
to a value and return the
value if it exists.def
isDefinedAt
( key : A ) : scala.Boolean
def
isEmpty
: scala.Boolean
def
keys
: scala.Iterator[A]
def
size
: scala.Int
def
toList
: scala.List[scala.Tuple2[A,B]]
def
toString
: java.lang.String
def
values
: scala.Iterator[B]