HashTable

HashTable

A hash table using linked overflow for collision resolving.  Depricated, use the HashMap class instead.

See Also

HashMap

Summary
HashTableA hash table using linked overflow for collision resolving.
Functions and Properties
hashStringA simple function for hashing strings.
hashIntA simple function for hashing integers.
HashTableInitializes a new hash table.
maxSizeThe hash table’s maximum capacity.
insertInserts a key/data couple into the table.
findFinds the entry that is associated with the given key.
removeRemoves an entry based on a given key.
contains@inheritDoc
clear@inheritDoc
getIterator@inheritDoc
size@inheritDoc
isEmpty@inheritDoc
toArray@inheritDoc
toStringPrints out a string representing the current object.
dumpPrints out all elements (for debug/demo purposes).
HashEntrySimple container class for storing a key/data couple.

Functions and Properties

hashString

public static function hashString(s: String):int

A simple function for hashing strings.

hashInt

public static function hashInt(i: int):int

A simple function for hashing integers.

HashTable

public function HashTable(size: int,  
hash: Function = null)

Initializes a new hash table.

Parameters

sizeThe size of the hash table.
hashA hashing function. 

maxSize

public function get maxSize():int

The hash table’s maximum capacity.

insert

public function insert(key: *,
obj: *):void

Inserts a key/data couple into the table.

Parameters

keyThe key.
objThe data associated with the key. 

find

public function find(key: *):*

Finds the entry that is associated with the given key.

Parameters

param key The key to search for.

Returns

The data associated with the key or null if no matching entry was found. 

remove

public function remove(key: *):*

Removes an entry based on a given key.

Parameters

param key The entry’s key.

Returns

The data associated with the key or null if no matching entry was found. 

contains

public function contains(obj: *):Boolean

@inheritDoc

clear

public function clear():void

@inheritDoc

getIterator

public function getIterator():Iterator

@inheritDoc

size

public function get size():int

@inheritDoc

isEmpty

public function isEmpty():Boolean

@inheritDoc

toArray

public function toArray():Array

@inheritDoc

toString

public function toString():String

Prints out a string representing the current object.

Returns

A string representing the current object. 

dump

public function dump():String

Prints out all elements (for debug/demo purposes).

Returns

A human-readable representation of the structure. 

HashEntry

Simple container class for storing a key/data couple.

A ‘java-style’ collection interface.
public static function hashString(s: String):int
A simple function for hashing strings.
public static function hashInt(i: int):int
A simple function for hashing integers.
public function HashTable(size: int,  
hash: Function = null)
Initializes a new hash table.
public function get maxSize():int
The hash table’s maximum capacity.
public function insert(key: *,
obj: *):void
Inserts a key/data couple into the table.
public function find(key: *):*
Finds the entry that is associated with the given key.
public function remove(key: *):*
Removes an entry based on a given key.
public function contains(obj: *):Boolean
@inheritDoc
public function clear():void
@inheritDoc
public function getIterator():Iterator
@inheritDoc
public function get size():int
@inheritDoc
public function isEmpty():Boolean
@inheritDoc
public function toArray():Array
@inheritDoc
public function toString():String
Prints out a string representing the current object.
public function dump():String
Prints out all elements (for debug/demo purposes).
The ‘HashMap’ class stores data in key/value pairs.
Close