scala.collection.mutable

trait DefaultMapModel

[source: scala/collection/mutable/DefaultMapModel.scala]

trait DefaultMapModel[A, B]
extends Map[A, B]
This class is used internally. It implements the mutable Map class in terms of three functions: findEntry, addEntry, and entries.
Author
Matthias Zenger
Version
1.0, 08/07/2003
Direct Known Subclasses:
HashMap, LinkedHashMap

Type Summary
type Entry
Method Summary
protected abstract def addEntry (e : DefaultEntry) : Unit
def elements : Iterator[(A, B)]
Creates a new iterator over all elements contained in this object.
protected abstract def entries : Iterator[DefaultEntry]
protected abstract def findEntry (key : A) : DefaultEntry
def get (key : A) : Option[B]
Check if this map maps key to a value and return the value if it exists.
def update (key : A, value : B) : 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.
Methods inherited from Map
-= (abstract), +=, +=, ++=, ++=, +, +, ++, ++, -=, --=, --=, -, removeKey, put, -, --, --, clear, getOrElseUpdate, transform, retain, <<, clone, readOnly, +=, incl, excl
Methods inherited from Map
size (abstract), getOrElse, isEmpty, apply, contains, isDefinedAt, keys, keySet, values, equals, hashCode, toString, default, projection, filterKeys, mapElements, stringPrefix
Methods inherited from Collection
toArray
Methods inherited from Iterable
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 PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from AnyRef
getClass, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Type Details
type Entry

Method Details
protected abstract def findEntry(key : A) : DefaultEntry

protected abstract def addEntry(e : DefaultEntry) : Unit

protected abstract def entries : Iterator[DefaultEntry]

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

def update(key : A, value : B) : 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

def elements : Iterator[(A, B)]
Creates a new iterator over all elements contained in this object.
Returns
the new iterator