in scala/collection/mutable
trait DefaultMapModel
-
trait DefaultMapModel[A,B]()
- extends Map[A,B]
- with ScalaObject
-
Implementing classes or objects:
-
class HashMap[A,B]()
-
This trait is used internally. It implements the mutable
Map
trait in terms of three functions: findEntry
, addEntry
,
and entries
.
- Author:
-
Matthias Zenger
- Version:
-
1.0, 08/07/2003
Methods inherited from java/lang/Object-class
|
eq, finalize, getClass, notify, notifyAll, synchronized, wait, wait, wait |
Methods inherited from scala/collection/Map-class
|
apply, contains, equals, exists, forall, foreach, isDefinedAt, isEmpty, keys, size, toList, values |
Methods inherited from scala/collection/mutable/Map-class
|
++=, ++=, +=, --=, --=, -=, <<, clear, clone, excl, filter, hashCode, incl, map, mappingToString, toString |
Class Summary
|
protected
|
class Entry(k: A, v: B)
|
findEntry
protected abstract def findEntry(key: A): Option[Entry]
addEntry
protected abstract def addEntry(e: Entry): Unit
entries
protected abstract def entries: Iterator[Entry]
get
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
update
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.
elements
def elements: Iterator[Tuple2[A,B]]
-
Creates a new iterator over all elements contained in this
object.
- Returns:
-
the new iterator