TinyLine
v2.0

com.tinyline.tiny2d
Class TinyHash

java.lang.Object
  extended bycom.tinyline.tiny2d.TinyHash

public final class TinyHash
extends java.lang.Object

The TinyHash class implements a hashtable, which maps keys to values.

Version:
2.0

Author:
Andrew Girow

Constructor Summary
TinyHash(int i)
          Creates a new empty hashtable with the given initial capacity.
 
Method Summary
 void clear()
          Clears this hashtable so that it contains no entries.
 java.lang.Object get(java.lang.Object key)
          Returns the value object to which the specified key obejct is mapped.
 boolean iterHasMore()
          Returns true if the iteration has more elements.
 void iterInit()
          Initializes the iteration for this hashtable.
 java.lang.Object iterNext()
          Returns the next element in the iteration.
 int put(java.lang.Object key, java.lang.Object value)
          Maps the specified key object to the specified value object.
 int remove(java.lang.Object key)
          Removes the key object (and corresponding value object) from the hashtable.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TinyHash

public TinyHash(int i)
Creates a new empty hashtable with the given initial capacity.

Parameters:
i - the initial capacity of the hashtable.
Method Detail

get

public java.lang.Object get(java.lang.Object key)
Returns the value object to which the specified key obejct is mapped.

Parameters:
key - a key object in the hashtable.
Returns:
the value object to which the key is mapped in this hashtable; null if the key is found or the key is null.

put

public int put(java.lang.Object key,
               java.lang.Object value)
Maps the specified key object to the specified value object.

Parameters:
key - the key object.
value - the value object.
Returns:
-1 if the value object or key object is null and 0 otherwise.

remove

public int remove(java.lang.Object key)
Removes the key object (and corresponding value object) from the hashtable.

Parameters:
key - the key object to be removed.
Returns:
0 if the pair is removed and -1 otherwise.

clear

public void clear()
Clears this hashtable so that it contains no entries.


iterInit

public void iterInit()
Initializes the iteration for this hashtable.


iterHasMore

public boolean iterHasMore()
Returns true if the iteration has more elements.

Returns:
true if the iteration has more elements.

iterNext

public java.lang.Object iterNext()
Returns the next element in the iteration.

Returns:
the next element in the iteration or null.

TinyLine
v2.0

Provided under the terms of the TinyLine License Agreement that has been included with this distribution