|
Scala
1.3.0.4 |
|||
HashTable[A] implements a hashtable
that maps keys of type A to values of the fully abstract
member type Entry. Classes that make use of HashTable
have to provide an implementation for Entry and implement the
function entryKey.
There are mainly two parameters that affect the performance of a hashtable:
the initial size and the load factor. The size
refers to the number of buckets in the hashtable, and the load
factor is a measure of how full the hashtable is allowed to get before
its size is automatically doubled. Both parameters may be changed by
overriding the corresponding values in class HashTable.
| Field Summary | |
protected abstract
|
type Entry
|
protected
|
val initialSize: Int
The initial size of the hash table. |
protected
|
val initialThreshold: Int
The initial threshold |
protected
|
val loadFactor: Float
The load factor for the hash table. |
| Method Summary | |
protected
|
def addEntry(e: Entry): Unit
|
protected
|
def elemEquals(key1: A, key2: A): Boolean
|
protected
|
def elemHashCode(key: A): Int
|
protected
|
def entries: Iterator[Entry]
|
protected abstract
|
def entryKey(e: Entry): A
|
protected
|
def findEntry(key: A): Option[Entry]
|
protected final
|
def improve(hcode: Int): Int
|
protected final
|
def index(hcode: Int): Int
|
protected
|
def initTable(tb: Array[List[Entry]]): Unit
|
protected
|
def removeEntry(key: A): Unit
|
def size: Int
Returns the size of this hash map. |
|
protected
|
var table: Array[List[Entry]]
The actual hash table. |
protected
|
var tableSize: Int
The number of mappings contained in this hash table. |
protected
|
var threshold: Int
The next size value at which to resize (capacity * load factor). |
| Methods inherited from java/lang/Object-class |
| clone, eq, equals, finalize, getClass, hashCode, notify, notifyAll, synchronized, toString, wait, wait, wait |
| Methods inherited from scala/Any-class |
| !=, ==, asInstanceOf, isInstanceOf, match |
| Field Detail |
protected val loadFactor: Float
protected val initialSize: Int
protected val initialThreshold: Int
protected abstract type Entry
| Method Detail |
protected var table: Array[List[Entry]]
protected var tableSize: Int
protected var threshold: Int
def size: Int
protected def findEntry(key: A): Option[Entry]
protected def addEntry(e: Entry): Unit
protected def removeEntry(key: A): Unit
protected abstract def entryKey(e: Entry): A
protected def entries: Iterator[Entry]
protected def initTable(tb: Array[List[Entry]]): Unit
protected def elemEquals(key1: A, key2: A): Boolean
protected def elemHashCode(key: A): Int
protected final def improve(hcode: Int): Int
protected final def index(hcode: Int): Int
|
Scala
1.3.0.4 |
|||