in scala/collection/mutable
trait DefaultMapModel
-
trait DefaultMapModel[A,B]()
- extends Object
- with ScalaObject
- with Map[A,B]
-
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
Field Summary
|
protected
|
type Entry
|
Methods inherited from java/lang/Object-class
|
eq, finalize, getClass, ne, 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
|
++=, ++=, +=, --=, --=, -=, <<, MapTo, clear, clone, excl, filter, hashCode, incl, map, mappingToString, toString |
Entry
protected type Entry = DefaultEntry[A,B]
findEntry
protected abstract def findEntry(key: A): Option[DefaultEntry[A,B]]
addEntry
protected abstract def addEntry(e: DefaultEntry[A,B]): Unit
entries
protected abstract def entries: Iterator[DefaultEntry[A,B]]
get
def get(key: A): Option[B] with CaseClass
-
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.
- Parameters:
key
-
value
-
elements
def elements: Iterator[Tuple2[A,B]]
-
Creates a new iterator over all elements contained in this
object.
- Returns:
-
the new iterator