in scala/collection/mutable
class HashTable

abstract class HashTable[A]()
extends Object
with ScalaObject
Implementing classes or objects:
class HashSet[A]()
class HashMap[A,B]()

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 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.

Author:
Matthias Zenger
Version:
1.0, 08/07/2003

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

loadFactor

  protected val loadFactor: Float
The load factor for the hash table.

initialSize

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

initialThreshold

  protected val initialThreshold: Int
The initial threshold

Entry

  protected abstract type Entry
Method Detail

table

  protected var table: Array[List[Entry]]
The actual hash table.

tableSize

  protected var tableSize: Int
The number of mappings contained in this hash table.

threshold

  protected var threshold: Int
The next size value at which to resize (capacity * load factor).

size

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

findEntry

  protected def findEntry(key: A): Option[Entry]

addEntry

  protected def addEntry(e: Entry): Unit

removeEntry

  protected def removeEntry(key: A): Unit

entryKey

  protected abstract def entryKey(e: Entry): A

entries

  protected def entries: Iterator[Entry]

initTable

  protected def initTable(tb: Array[List[Entry]]): Unit

elemEquals

  protected def elemEquals(key1: A, key2: A): Boolean

elemHashCode

  protected def elemHashCode(key: A): Int

improve

  protected final def improve(hcode: Int): Int

index

  protected final def index(hcode: Int): Int