scala.collection.mutable

class HashMap

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

@serializable

class HashMap[A, B]
extends Map[A, B] with MutableMapTemplate[A, B, HashMap[A, B]] with HashTable[A]
Direct Known Subclasses:
BytePickle.PicklerEnv, BytePickle.UnPicklerEnv

Type Summary
type Entry
Values and Variables inherited from HashTable
loadFactorDenum, table, tableSize, threshold
Method Summary
def += (kv : (A, B)) : HashMap[A, B]
Add a new key/value mapping this map.
def -= (key : A) : HashMap[A, B]
Delete a key from this map if it is present.
override def clear : Unit
Remove all entries from table
override def empty : HashMap[A, B]
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.
override def remove (key : A) : Option[B]
If given key is defined in this map, remove it and return associated value as an Option. If key is not present return None.
override def size : Int
Returns the size of this hash table.
override def update (key : A, value : B) : Unit
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 HashTable
loadFactor, initialSize, initialThreshold, findEntry, addEntry, removeEntry, entriesIterator, entries, elemEquals, elemHashCode, improve, index
Methods inherited from Unhashable
hashCode, identityHashCode
Methods inherited from MutableMapTemplate
newBuilder, updated, cached, +, +, ++, ++, -, removeKey, getOrElseUpdate, transform, retain, clone, result, -, --, --
Methods inherited from Shrinkable
-=, --=, --=
Methods inherited from Builder
sizeHint, mapResult
Methods inherited from Growable
+=, ++=, ++=
Methods inherited from MutableMapTemplateBase
+
Methods inherited from MapTemplate
isEmpty, getOrElse, apply, contains, isDefinedAt, keySet, keysIterator, keys, valueIterable, valuesIterator, values, default, filterKeys, mapValues, mapElements, +, ++, ++, addString, equals, stringPrefix, toString
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from Iterable
companion
Methods inherited from IterableTemplate
elements, foreach, foldRight, reduceRight, toIterable, head, takeRight, dropRight, sameElements, toStream, view, view, first, firstOption, toSeq, projection
Methods inherited from TraversableClass
genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableTemplate
thisCollection, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterMap, filterNot, remove, partition, groupBy, forall, exists, count, find, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, headOption, tail, last, lastOption, init, take, drop, slice, takeWhile, dropWhile, span, splitAt, copyToBuffer, copyToArray, copyToArray, toArray, toList, toSequence, toSet, mkString, mkString, mkString, addString, addString
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
override def empty : HashMap[A, B]
Overrides
Map.empty

override def clear : Unit
Remove all entries from table
Overrides
MutableMapTemplate.clear, HashTable.clear

override def size : Int
Returns the size of this hash table.
Overrides
HashTable.size

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
Overrides
MutableMapTemplate.put

override def update(key : A, value : B) : Unit
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
Returns
An option consisting of value associated previously associated with `key` in the map, or None if `key` was not yet defined in the map.
Overrides
MutableMapTemplate.update

override def remove(key : A) : Option[B]
If given key is defined in this map, remove it and return associated value as an Option. If key is not present return None.
Parameters
key - the key to be removed
Overrides
MutableMapTemplate.remove

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

def -=(key : A) : HashMap[A, B]
Delete a key from this map if it is present.
Parameters
key - the key to be removed
Notes
same as `delete`.
Overrides
MutableMapTemplate.-=

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