|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Interface for a dictionary in the "simple" package.
A dictionary is a container that stores a collection of items (each a key-element pair) that can be inserted, removed, and accessed (searched for) by specifying a key.
A dictionary may store multiple items with the same key.
A dictionary should store arbitrary objects by may restrict the type of keys that can be stored, and thus reject unacceptable keys throwing an InvalidKeyException. For example, an ordered dictionary accepts only keys from the set on which a given total order relation is defined.
EmptyContainerException,
InvalidKeyException,
Comparator,
Dictionary| Field Summary | |
static java.lang.Object |
NO_SUCH_KEY
Special element returned by the search and removal methods when no item with the specified key is stored in the dictionary. |
| Method Summary | |
java.util.Enumeration |
elements()
Report the elements of all the items stored in the dictionary. |
java.util.Enumeration |
findAllElements(java.lang.Object key)
Search for all the items with the specified key and return their elements. |
java.lang.Object |
findElement(java.lang.Object key)
Search for an item with the specified key. |
void |
insertItem(java.lang.Object key,
java.lang.Object element)
Insert an item. |
java.util.Enumeration |
keys()
Report the keys of all the items stored in the dictionary. |
java.lang.Object |
remove(java.lang.Object key)
Remove an item with the specified key. |
java.util.Enumeration |
removeAll(java.lang.Object key)
Remove all the items with the specified key. |
| Methods inherited from interface jdsl.simple.api.SimpleContainer |
isEmpty,
size |
| Field Detail |
public static final java.lang.Object NO_SUCH_KEY
| Method Detail |
public java.lang.Object findElement(java.lang.Object key)
throws InvalidKeyException
key - search key.
public java.util.Enumeration findAllElements(java.lang.Object key)
throws InvalidKeyException
key - An object comparable or indexable under whatever
scheme the implementation uses for performing lookupskey - search key.
public void insertItem(java.lang.Object key,
java.lang.Object element)
throws InvalidKeyException
key - object.element - arbitrary object.
public java.lang.Object remove(java.lang.Object key)
throws InvalidKeyException
key - search key.
public java.util.Enumeration removeAll(java.lang.Object key)
throws InvalidKeyException
key - search key.public java.util.Enumeration keys()
public java.util.Enumeration elements()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||