scala.collection.jcl

trait Map

[source: scala/collection/jcl/Map.scala]

trait Map[K, E]
extends MutableIterable[(K, E)] with Map[K, E]
A mutable map that is compatible with Java maps.
Author
Sean McDirmid
Direct Known Subclasses:
Map.Projection, MapWrapper, SortedMap

Method Summary
override def + (pair : (K, E)) : Map
Add a key/value pair to this map.
override def += (pair : (K, E)) : Unit
Add a key/value pair to this map.
override def - (key : K) : Map
Remove a key from this map
override def -= (key : K) : Unit
Remove a key from this map, noop if key is not present.
override def clear : Unit
Removes all mappings from the map. After this operation is completed, the map is empty.
override abstract def elements : MutableIterator[(K, E)]
The default implementation of a map over mutable iterable collections.
override def filterKeys (p : (K) => Boolean) : Projection[K, E]
non-strict filter based on keys only
override def get (key : K) : Option[E]
Check if this map maps key to a value and return the value if it exists.
override def has (pair : (K, E)) : Boolean
override def isEmpty : Boolean
Is this an empty map?
override def keySet : Set[K]
override final def keys : MutableIterator[K]
Creates an iterator for all keys.
def lense [F](f : (E) => F, g : (F) => E) : Projection[K, F]
override def projection : Projection[K, E]
returns a projection that can be used to call non-strict filter, map, and flatMap methods that build projections of the collection.
abstract def put (key : K, elem : E) : Option[E]
def putAll (that : Iterable[(K, E)]) : Unit
override def remove (p : (K, E)) : Boolean
def removeKey (key : K) : Option[E]
override def update (key : K, e : E) : Unit
This method allows one to add a new mapping from key to value to the map. If the map already contains a mapping for key, it will be overridden by this function.
def valueSet : Projection[E]
The values of this map as a projection, which means removals from the returned collection will remove the element from this map.
Methods inherited from Map
+=, ++=, ++=, +, ++, ++, -=, --=, --=, -, --, --, getOrElseUpdate, transform, retain, <<, clone, +=, incl, excl
Methods inherited from Map
size (abstract), getOrElse, apply, contains, isDefinedAt, values, equals, hashCode, toString, default, mapElements
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from MutableIterable
removeAll, --, -, retain, retainAll, size0
Methods inherited from Collection
toArray, stringPrefix, equalWith
Methods inherited from Iterable
concat, ++, map, flatMap, filter, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, mkString, mkString, addString, addString, copyToArray, hasDefiniteSize
Methods inherited from AnyRef
getClass, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Class Summary
protected class Filter (p : (K) => Boolean) extends Projection[K, E]
protected class KeySet extends Set[K]
protected class Lense [F](f : (E) => F, g : (F) => E) extends Projection[K, F]
Method Details
override def clear : Unit
Removes all mappings from the map. After this operation is completed, the map is empty.
Overrides
MutableIterable.clear, Map.clear

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

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

override final def keys : MutableIterator[K]
Creates an iterator for all keys.
Returns
an iterator over all keys.

def valueSet : Projection[E]
The values of this map as a projection, which means removals from the returned collection will remove the element from this map.
Returns
s a projection of this map's elements.

abstract def put(key : K, elem : E) : Option[E]

def putAll(that : Iterable[(K, E)]) : Unit

def removeKey(key : K) : Option[E]

override def has(pair : (K, E)) : Boolean
Returns
true if t is in the collection.
Overrides
MutableIterable.has

override def get(key : K) : Option[E]
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

override def update(key : K, e : E) : Unit
This method allows one to add a new mapping from key to value to the map. If the map already contains a mapping for key, it will be overridden by this function.
Parameters
key - The key to update
value - The new value
Overrides
Map.update

override def +(pair : (K, E)) : Map
Add a key/value pair to this map.
Parameters
kv - the key/value pair.
Returns
The map itself with the new binding added in place.
Overrides
Map.+

override def +=(pair : (K, E)) : Unit
Add a key/value pair to this map.
Parameters
kv - the key/value pair.
Overrides
Map.+=

override def -(key : K) : Map
Remove a key from this map
Parameters
key - the key to be removed
Returns
The map itself with the binding for key removed if it existed.
Overrides
Map.-

override def remove(p : (K, E)) : Boolean
Returns
true if t was removed from this collection.
Overrides
MutableIterable.remove

override def -=(key : K) : Unit
Remove a key from this map, noop if key is not present.
Parameters
key - the key to be removed
Overrides
Map.-=

override abstract def elements : MutableIterator[(K, E)]
The default implementation of a map over mutable iterable collections.
Overrides
MutableIterable.elements

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

def lense[F](f : (E) => F, g : (F) => E) : Projection[K, F]

override def filterKeys(p : (K) => Boolean) : Projection[K, E]
non-strict filter based on keys only