|
Scala
1.4.0.3 |
|||
Map
may only be used for
accessing elements from map implementations. Two different extensions
of trait Map
in the package scala.collections.mutable
and scala.collections.immutable
provide functionality for
adding new key/value mappings to a map. The trait in the first package is
implemented by maps that are modified destructively, whereas the trait in
the second package is used by functional map implementations that rely on
immutable data structures.
Method Summary | |
def apply(key: A): B
Retrieve the value which is associated with the given key. |
|
def contains(key: A): Boolean
Is the given key mapped to a value by this map? |
|
override
|
def equals(that: Any): Boolean
Compares two maps structurally; i.e. |
def exists(p: (A,B) => Boolean): 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 exists(p: (A) => Boolean): Boolean
Apply a predicate p to all elements of this
iterable object and return true, iff there is at least one
element for which p yields true.
|
|
def forall(p: (A,B) => Boolean): 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 forall(p: (A) => Boolean): Boolean
Apply a predicate p to all elements of this
iterable object and return true, iff the predicate yields
true for all elements.
|
|
def foreach(f: (A,B) => Unit): Unit
Executes the given function for all (key, value) pairs contained in this map. |
|
def foreach(f: (A) => Unit): Unit
Apply a function f to all elements of this
iterable object.
|
|
abstract
|
def get(key: A): Option[B]
Check if this map maps key to a value and return the
value if it exists.
|
def isDefinedAt(key: A): Boolean
Does this map contain a mapping from the given key to a value? |
|
def isEmpty: Boolean
Is this an empty map? |
|
def keys: Iterator[A]
Creates an iterator for all keys. |
|
abstract
|
def size: Int
Compute the number of key-to-value mappings. |
def toList: List[Tuple2[A,B]]
Returns the mappings of this map as a list. |
|
override
|
def toString(): String
Creates a string representation for this map. |
def values: Iterator[B]
Creates an iterator for a contained values. |
Methods inherited from java/lang/Object-class |
clone, eq, finalize, getClass, hashCode, ne, notify, notifyAll, synchronized, wait, wait, wait |
Methods inherited from scala/Any-class |
!=, ==, asInstanceOf, isInstanceOf, match |
Methods inherited from scala/Iterable-class |
/:, :\, concat, elements, exists, find, foldLeft, foldRight, forall, foreach, sameElements |
Methods inherited from scala/ScalaObject-class |
getScalaType |
Method Detail |
abstract def size: Int
abstract def get(key: A): Option[B]
key
to a value and return the
value if it exists.
key
-
the key of the mapping of interest
def isEmpty: Boolean
def apply(key: A): B
key
-
the key
def contains(key: A): Boolean
key
-
the key
def isDefinedAt(key: A): Boolean
key
-
the key
def keys: Iterator[A]
def values: Iterator[B]
def foreach(f: (A,B) => Unit): Unit
f
-
the function to execute.
def foreach(f: (A) => Unit): Unit
f
to all elements of this
iterable object.
f
-
a function that is applied to every element.
def forall(p: (A,B) => Boolean): Boolean
p
-
the predicate
def forall(p: (A) => Boolean): Boolean
p
to all elements of this
iterable object and return true, iff the predicate yields
true for all elements.
p
-
the predicate
def exists(p: (A,B) => Boolean): Boolean
p
-
the predicate
def exists(p: (A) => Boolean): Boolean
p
to all elements of this
iterable object and return true, iff there is at least one
element for which p
yields true.
p
-
the predicate
override def equals(that: Any): Boolean
def toList: List[Tuple2[A,B]]
override def toString(): String
|
Scala
1.4.0.3 |
|||