scala.collection.mutable

trait HashTable

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

trait HashTable[A]
extends AnyRef
This class can be used to construct data structures that are based on hashtables. Class 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 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.
Author
Matthias Zenger
Martin Odersky
Version
2.0, 31/12/2006
Direct Known Subclasses:
HashMap, HashMap

Type Summary
protected abstract type Entry <: HashEntry[A, Entry] >: Null
Value Summary
protected val initialThreshold : Int
The initial threshold
protected final val loadFactorDenum : Int = 1000
protected var table : Array[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
def clear : Unit
protected def elemEquals (key1 : A, key2 : A) : Boolean
protected def elemHashCode (key : A) : Int
protected def entries : Iterator[Entry]
protected def findEntry (key : A) : Entry
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 loadFactor : Int
The load factor for the hash table (in 0.001 step).
protected def removeEntry (key : A) : Unit
def size : Int
Returns the size of this hash table.
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
protected abstract type Entry <: HashEntry[A, Entry] >: Null

Value Details
protected final val loadFactorDenum : Int

protected val initialThreshold : Int
The initial threshold

protected var table : Array[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 Details
protected def loadFactor : Int
The load factor for the hash table (in 0.001 step).

protected def initialSize : Int
The initial size of the hash table.

def size : Int
Returns the size of this hash table.

protected def findEntry(key : A) : Entry

protected def addEntry(e : Entry) : Unit

protected def removeEntry(key : A) : Unit

protected def entries : Iterator[Entry]

def clear : 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