blob: d7bd56498fdb17bfbdb19c4bc6e33caeabbe8eae (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.collection.mutable
import Predef._
/** This class implements mutable maps using a hashtable.
*
* @author Matthias Zenger
* @author Martin Odersky
* @version 2.0, 31/12/2006
*/
object HashMap {
/** The empty map of this type */
def empty[A, B] = new HashMap[A, B]
/** The canonical factory for this type
*/
def apply[A, B](elems: Pair[A, B]*) = empty[A, B] ++ elems
}
[serializable]
class HashMap[A, B] extends Map[A,B] with HashTable[A] with DefaultMapModel[A,B] {
def -= (key: A) { removeEntry(key) }
override def clear = {
initTable()
tableSize = 0
}
override def clone(): Map[A, B] = new HashMap[A, B] ++ this
}
|