Interface IMap

All Known Implementing Classes:
JavaMap

public interface IMap

Required methods for the Map ADT.


Field Summary
static Object NO_SUCH_ELEMENT
          Constant representing a key that is not in this.
 
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.
 

Field Detail

NO_SUCH_ELEMENT

public static final Object NO_SUCH_ELEMENT
Constant representing a key that is not in this.

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.

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.

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.

Parameters:
aKey - key for element to remove

size

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


isEmpty

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