atg.core.util
Class ArrayDictionary

java.lang.Object
  extended by java.util.Dictionary
      extended by atg.core.util.ArrayDictionary

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.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
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
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

ArrayDictionary

public ArrayDictionary()
Constructs a new ArrayDictionary


ArrayDictionary

public ArrayDictionary(java.lang.Object[] pKeys,
                       java.lang.Object[] pValues)
Constructs a new ArrayDictionary with the given lists of keys and values

Method Detail

clear

public void clear()

put

public java.lang.Object put(java.lang.Object pKey,
                            java.lang.Object pValue)
Specified by:
put in class java.util.Dictionary

get

public java.lang.Object get(java.lang.Object pKey)
Specified by:
get in class java.util.Dictionary

remove

public java.lang.Object remove(java.lang.Object pKey)
Specified by:
remove in class java.util.Dictionary

size

public int size()
Specified by:
size in class java.util.Dictionary

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in class java.util.Dictionary

keys

public java.util.Enumeration keys()
Specified by:
keys in class java.util.Dictionary

elements

public java.util.Enumeration elements()
Specified by:
elements in class java.util.Dictionary

toString

public java.lang.String toString()
Returns a string representation of this hashtable.

Overrides:
toString in class java.lang.Object