in scala.collection
class Map

mixin abstract class Map [ A , B ]
extends java.lang.Object
with PartialFunction
with Iterable
with ScalaObject
This class defines the interface of collections that unambiguously map keys to values (i.e. a key is mapped to at least one value). Class Map 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.
author:
Matthias Zenger
version:
1.1, 02/05/2004

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 : Function2 ) : 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 : Function2 ) : 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 : Function2 ) : scala.Unit
Executes the given function for all (key, value) pairs contained in this map.
def get ( key : A ) : Option
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 : Iterator
Creates an iterator for all keys.
def size : scala.Int
Compute the number of key-to-value mappings.
def toList : List
Returns the mappings of this map as a list.
override def toString : java.lang.String
Creates a string representation for this map.
def values : Iterator
Creates an iterator for a contained values.


Def Detail
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.
param:
key the key
return:
the value associated with the given key.

def contains ( key : A ) : scala.Boolean
Is the given key mapped to a value by this map?
param:
key the key
return:
true, iff there is a mapping for key in 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.
return:
true, iff both maps contain exactly the same mappings.

def exists ( p : Function2 ) : 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.
param:
p the predicate
return:
true, iff there is at least one mapping for which p yields true.

def forall ( p : Function2 ) : 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.
param:
p the predicate
return:
true, iff p yields true for all mappings.

def foreach ( f : Function2 ) : scala.Unit
Executes the given function for all (key, value) pairs contained in this map.
param:
f the function to execute.

def get ( key : A ) : Option
Check if this map maps key to a value and return the value if it exists.
param:
key the key of the mapping of interest
return:
the value of the mapping, if it exists

def isDefinedAt ( key : A ) : scala.Boolean
Does this map contain a mapping from the given key to a value?
param:
key the key
return:
true, iff there is a mapping for key in this map

def isEmpty : scala.Boolean
Is this an empty map?
return:
true, iff the map is empty.

def keys : Iterator
Creates an iterator for all keys.
return:
an iterator over all keys.

def size : scala.Int
Compute the number of key-to-value mappings.
return:
the number of mappings

def toList : List
Returns the mappings of this map as a list.
return:
a list containing all mappings

override def toString : java.lang.String
Creates a string representation for this map.
return:
a string showing all mappings

def values : Iterator
Creates an iterator for a contained values.
return:
an iterator over all values.