public class ArrayDictionary
extends java.util.Dictionary
An ArrayDictionary is an implementation of Dictionary that stores its keys and values as arrays. Lookups are performed using a linear search. Adding new elements requires no new object allocations. This is best used for very small key/value mappings that require a Dictionary interface. In addition, this allows null values to be exposed as values, if the ArrayDictionary is created with a pair of arrays. Other Dictionary implementations, such as Hashtable, do not allow null values.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
Constructor and Description |
---|
ArrayDictionary()
Constructs a new ArrayDictionary
|
ArrayDictionary(java.lang.Object[] pKeys,
java.lang.Object[] pValues)
Constructs a new ArrayDictionary with the given lists of keys and
values
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
java.util.Enumeration |
elements() |
java.lang.Object |
get(java.lang.Object pKey) |
boolean |
isEmpty() |
java.util.Enumeration |
keys() |
java.lang.Object |
put(java.lang.Object pKey,
java.lang.Object pValue) |
java.lang.Object |
remove(java.lang.Object pKey) |
int |
size() |
java.lang.String |
toString()
Returns a string representation of this hashtable.
|
public ArrayDictionary()
public ArrayDictionary(java.lang.Object[] pKeys, java.lang.Object[] pValues)
public void clear()
public java.lang.Object put(java.lang.Object pKey, java.lang.Object pValue)
put
in class java.util.Dictionary
public java.lang.Object get(java.lang.Object pKey)
get
in class java.util.Dictionary
public java.lang.Object remove(java.lang.Object pKey)
remove
in class java.util.Dictionary
public int size()
size
in class java.util.Dictionary
public boolean isEmpty()
isEmpty
in class java.util.Dictionary
public java.util.Enumeration keys()
keys
in class java.util.Dictionary
public java.util.Enumeration elements()
elements
in class java.util.Dictionary
public java.lang.String toString()
toString
in class java.lang.Object