|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
public interface StaticDictionaryInterface
A static dictionary interface, for objects which retrieve values by an Object key. This interface defines read-only access to a dictionary. You can count the number of items; obtain enumerations of the keys or values; or test if the dictionary contains a key or value.
A Dictionary is like a
(which extends the abstract Hashtable
class) but has some differences. A com.sas.collection.Dictionary can have null values for either
the keys or the values. This implies that
simply testing the result of a get call for null
Dictionary
Object value = dictionary.get(myKey);
if (value != null)
// assume the key exists...
will not work for com.sas.collection dictionaries
(because if it returned null, there would be no way to
know if the null was the value associated with the key,
or if the null meant no such value exists.)
The get method will throw a NoSuchElementException
if there is no corresponding item for the key
you specify.
Instead, you must first test if the dictionary
contains the item:
if ( dictionary.containsKey(myKey) )
{
Obect value = dictionary.get(myKey);
// and so on
}
Dictionary,
StaticDictionary,
AssociationList| Method Summary | |
|---|---|
abstract java.lang.Object |
clone()
Clone the object. |
abstract boolean |
containsKey(java.lang.Object key)
Test the existence of an key in a dictionary. |
abstract java.lang.Object |
get(java.lang.Object key)
Fetch the item corresponding to a key. |
abstract java.lang.Object |
getKey(java.lang.Object item)
Get the key corrsponding to an item. |
abstract java.util.Enumeration |
getKeys()
Return an enumeration of all the keys. |
abstract java.util.Enumeration |
getKeys(java.lang.Object item)
Return an enumeration of all the keys for a given item. |
| Methods inherited from interface com.sas.collection.StaticCollectionInterface |
|---|
apply, contains |
| Methods inherited from interface com.sas.collection.ContentsChangedSource |
|---|
addContentsChangedListener, removeContentsChangedListener |
| Methods inherited from interface com.sas.beans.PropertyChangeSource |
|---|
addPropertyChangeListener, removePropertyChangeListener |
| Methods inherited from interface com.sas.util.Countable |
|---|
count |
| Methods inherited from interface com.sas.util.Enumerable |
|---|
getItems |
| Method Detail |
|---|
boolean containsKey(java.lang.Object key)
key - the key to search for
java.lang.Object get(java.lang.Object key)
key - the Object key with which the item was inserted.
null.
java.util.NoSuchElementException - when there is no item for
the specified key. (Note that null
is a valid value for a key or a value.)java.lang.Object getKey(java.lang.Object item)
item - the item whose key you wish to find.
null;
this does not mean there is no
key for the item, just that the item's
key was actually null.
java.util.NoSuchElementException - if the item was not foundjava.util.Enumeration getKeys(java.lang.Object item)
item - the item to search for
java.util.Enumeration getKeys()
java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface com.sas.PublicClonableclone in interface StaticCollectionInterfacejava.lang.CloneNotSupportedException - if the object could not be cloned.
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||