scala.collection

trait MapProxy

[source: scala/collection/MapProxy.scala]

trait MapProxy[A, +B]
extends Map[A, B] with CollectionProxy[(A, B)]
This is a simple wrapper class for scala.collection.Map. It is most useful for assembling customized map abstractions dynamically using object composition and forwarding.
Author
Matthias Zenger
Version
1.0, 21/07/2003
Direct Known Subclasses:
MapProxy

Method Summary
override 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.
override def contains (key : A) : Boolean
Is the given key mapped to a value by this map?
override 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 : Any) : 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.
override def filterKeys (p : (A) => Boolean) : Projection[A, B]
non-strict filter based on keys only
override def get (key : A) : Option[B]
Check if this map maps key to a value and return the value if it exists.
override def getOrElse [B2 >: B](key : A, default : => B2) : B2
Check if this map maps key to a value. Return that value if it exists, otherwise return default.
override def hashCode : Int
A hash method compatible with equals
override def isDefinedAt (key : A) : Boolean
Does this map contain a mapping from the given key to a value?
override def isEmpty : Boolean
Is this an empty map?
override def keySet : Set[A]
override def keys : Iterator[A]
Creates an iterator for all keys.
override def mapElements [C](f : (B) => C) : Projection[A, C]
non-strict map elements using existing key set
override def projection : Projection[A, B]
returns a projection that can be used to call non-strict filter, map, and flatMap methods that build projections of the collection.
override abstract def self : Map[A, B]
override def size : Int
Compute the number of key-to-value mappings.
override def toString : java.lang.String
Creates a string representation for this map.
override def values : Iterator[B]
Creates an iterator for a contained values.
Methods inherited from CollectionProxy
toArray
Methods inherited from IterableProxy
elements, concat, ++, map, flatMap, filter, partition, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, toSeq, toStream, mkString, mkString, mkString, addString, addString, addString, copyToArray, hasDefiniteSize
Methods inherited from Map
stringPrefix
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
override abstract def self : Map[A, B]
Overrides
CollectionProxy.self

override def size : Int
Compute the number of key-to-value mappings.
Returns
the number of mappings
Overrides
Map.size, CollectionProxy.size

override def get(key : A) : Option[B]
Check if this map maps key to a value and return the value if it exists.
Parameters
key - the key of the mapping of interest
Returns
the value of the mapping, if it exists
Overrides
Map.get

override def getOrElse[B2 >: B](key : A, default : => B2) : B2
Check if this map maps key to a value. Return that value if it exists, otherwise return default.
Overrides
Map.getOrElse

override def isEmpty : Boolean
Is this an empty map?
Returns
true iff the map is empty.
Overrides
Map.isEmpty

override 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.
Parameters
key - the key
Returns
the value associated with the given key.
Overrides
Map.apply

override def contains(key : A) : Boolean
Is the given key mapped to a value by this map?
Parameters
key - the key
Returns
true iff there is a mapping for key in this map
Overrides
Map.contains

override def isDefinedAt(key : A) : Boolean
Does this map contain a mapping from the given key to a value?
Parameters
key - the key
Returns
true iff there is a mapping for key in this map
Overrides
Map.isDefinedAt

override def keys : Iterator[A]
Creates an iterator for all keys.
Returns
an iterator over all keys.
Overrides
Map.keys

override def keySet : Set[A]
Returns
the keys of this map as a set.
Overrides
Map.keySet

override def values : Iterator[B]
Creates an iterator for a contained values.
Returns
an iterator over all values.
Overrides
Map.values

override def equals(that : Any) : 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.
Parameters
that - the other map
Returns
true iff both maps contain exactly the same mappings.
Overrides
Map.equals

override def hashCode : Int
A hash method compatible with equals
Overrides
Map.hashCode

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

override 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.
Parameters
key - the given key value
Throws
Predef.NoSuchElementException -
Overrides
Map.default

override def projection : Projection[A, B]
returns a projection that can be used to call non-strict filter, map, and flatMap methods that build projections of the collection.
Overrides
Map.projection

override def filterKeys(p : (A) => Boolean) : Projection[A, B]
non-strict filter based on keys only
Overrides
Map.filterKeys

override def mapElements[C](f : (B) => C) : Projection[A, C]
non-strict map elements using existing key set
Overrides
Map.mapElements