Scala Library
|
|
scala/collection/mutable/HashTable.scala
]
trait
HashTable[A]
extends
AnyRefHashTable[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
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
.Type Summary | |
protected abstract type
|
Entry <: HashEntry[A, Entry] >: Null |
Value Summary | |
protected final val
|
loadFactorDenum : Int = 1000 |
protected var
|
table
: Array[HashEntry[A, 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).
|
Method Summary | |
protected def
|
addEntry
(e : Entry) : Unit
Add entry to table
pre: no entry with same key exists
|
protected def
|
clearTable
: Unit
Remove all entries from table
|
protected def
|
elemEquals (key1 : A, key2 : A) : Boolean |
protected def
|
elemHashCode (key : A) : Int |
protected def
|
entries
: Iterator[Entry]
An iterator returning all entries
|
protected def
|
entriesIterator
: Iterator[Entry]
An iterator returning all entries
|
protected def
|
findEntry
(key : A) : Entry
Find entry with given key in table, null if not found
|
protected final def
|
improve (hcode : Int) : Int |
protected final def
|
index (hcode : Int) : Int |
protected def
|
initialSize
: Int
The initial size of the hash table.
|
protected def
|
initialThreshold
: Int
The initial threshold
|
protected def
|
loadFactor
: Int
The load factor for the hash table (in 0.001 step).
|
protected def
|
removeEntry
(key : A) : Entry
Remove entry from table if present
|
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Type Details |
Value Details |
protected final
val
loadFactorDenum : Int
protected
var
tableSize : Int
protected
var
threshold : Int
Method Details |
protected
def
loadFactor : Int
protected
def
initialSize : Int
protected
def
initialThreshold : Int
protected
def
entries : Iterator[Entry]
protected
def
clearTable : Unit
Scala Library
|
|