Class JavaMap

java.lang.Object
  |
  +--JavaMap
All Implemented Interfaces:
IMap

public class JavaMap
extends Object
implements IMap

IMap implementation using a Java Hashtable to store items.


Field Summary
protected  Hashtable items
          Hashtable used to store items in this.
 
Fields inherited from interface IMap
NO_SUCH_ELEMENT
 
Constructor Summary
JavaMap()
          Constructs an empty Java map.
 
Method Summary
 void insertItem(Object aKey, Object anElement)
          Inserts an item into this that associates the given key with the given element, increasing the size of this by 1 if the given key is not already in this.
 boolean isEmpty()
          Returns whether or not this is empty.
 Object lookupElement(Object aKey)
          Returns the element associated with the given key, or NO_SUCH_ELEMENT if the key is not in this.
 Object removeElement(Object aKey)
          Removes and returns the element in this that is associated with the given key, reducing the size of this by 1, or returns NO_SUCH_ELEMENT and does not change the size if the key is not in this.
 int size()
          Returns the number of items in this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

items

protected Hashtable items
Hashtable used to store items in this.

Constructor Detail

JavaMap

public JavaMap()
Constructs an empty Java map.

Method Detail

insertItem

public void insertItem(Object aKey,
                       Object anElement)
Inserts an item into this that associates the given key with the given element, increasing the size of this by 1 if the given key is not already in this.

Specified by:
insertItem in interface IMap
Parameters:
aKey - key for the element
anElement - element to be inserted

lookupElement

public Object lookupElement(Object aKey)
Returns the element associated with the given key, or NO_SUCH_ELEMENT if the key is not in this.

Specified by:
lookupElement in interface IMap
Parameters:
aKey - key for element to retrieve

removeElement

public Object removeElement(Object aKey)
Removes and returns the element in this that is associated with the given key, reducing the size of this by 1, or returns NO_SUCH_ELEMENT and does not change the size if the key is not in this.

Specified by:
removeElement in interface IMap
Parameters:
aKey - key for element to remove

size

public int size()
Returns the number of items in this.

Specified by:
size in interface IMap

isEmpty

public boolean isEmpty()
Returns whether or not this is empty.

Specified by:
isEmpty in interface IMap