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
Since
1
Type Summary
type Entry
Method Summary
def += (kv : (A, B)) : DefaultMapModel[A, B]
Add a new key/value mapping this map.
protected abstract def addEntry (e : DefaultEntry) : Unit
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 as an option if it exists, None if not.
def iterator : Iterator[(A, B)]
An iterator yielding all key/value mappings of this map.
override def put (key : A, value : B) : Option[B]
Adds a new mapping from key to value to the map. If the map already contains a mapping for key, it will be overridden.
Methods inherited from Map
empty
Methods inherited from MapLike
-= (abstract), newBuilder, update, updated, cached, +, +, ++, ++, remove, -, removeKey, clear, getOrElseUpdate, transform, retain, clone, result, -, --, --
Methods inherited from Shrinkable
-=, --=, --=
Methods inherited from Builder
sizeHint, mapResult
Methods inherited from Growable
+=, ++=, ++=
Methods inherited from MapLikeBase
+
Methods inherited from MapLike
isEmpty, getOrElse, apply, contains, isDefinedAt, keySet, keysIterator, keys, valuesIterable, valuesIterator, values, default, filterKeys, mapValues, mapElements, +, ++, ++, addString, stringPrefix, toString, hashCode, equals
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from Iterable
companion
Methods inherited from IterableLike
thisCollection, toCollection, elements, foreach, forall, exists, find, foldRight, reduceRight, toIterable, head, take, slice, takeWhile, takeRight, dropRight, copyToArray, zip, zipAll, zipWithIndex, sameElements, toStream, canEqual, view, view, first, firstOption, projection
Methods inherited from GenericTraversableTemplate
genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableLike
repr, nonEmpty, size, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, count, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, tail, last, lastOption, init, drop, dropWhile, span, splitAt, copyToBuffer, copyToArray, toArray, toList, toSeq, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, withFilter
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 as an option if it exists, None if not.
Parameters
key - the key of the mapping of interest.
Returns
the value of the mapping as an option, if it exists, or None.

override def put(key : A, value : B) : Option[B]
Adds a new mapping from key to value to the map. If the map already contains a mapping for key, it will be overridden.
Parameters
key - The key to update
value - The new value

def +=(kv : (A, B)) : DefaultMapModel[A, B]
Add a new key/value mapping this map.
Parameters
kv - the key/value pair.
Returns
the map itself

def iterator : Iterator[(A, B)]
An iterator yielding all key/value mappings of this map.