com.ibm.dse.applsrv.aa
Class IntegerKeyDictionary

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--com.ibm.dse.applsrv.aa.IntegerKeyDictionary

public class IntegerKeyDictionary
extends java.util.Dictionary
implements java.lang.Cloneable, java.io.Serializable

This class implements a dictionary which is keyed by integers.

See Also:
Serialized Form

Constructor Summary
IntegerKeyDictionary()
           
IntegerKeyDictionary(int initialCapacity)
           
 
Method Summary
 void add(int key, java.lang.Object value)
          Maps the specified key to the specified value in this dictionary.
 void addAll(java.util.Hashtable d)
          Add all of the entries in the argument hash table to the current dictionary.
 void addAll(IntegerKeyDictionary d)
          Add all of the entries in the argument dictionary to the current dictionary.
 Dictionary asDictionary()
          Return a regular dictionary corresponding to this dictionary but using Integer keys rather than int keys.
 void clear()
          Clears this dictionary so that it contains no elements.
 java.lang.Object clone()
          Creates a shallow copy of this dictionary.
 boolean contains(java.lang.Object value)
          Tests if this dictionary contains the specified value.
 boolean containsKey(int key)
          Tests if the specified integer is a key in this dictionary.
 IntegerKeyDictionary copy()
          Creates a shallow copy of this dictionary.
static IntegerKeyDictionary copy(IntegerKeyDictionary aDictionary)
          Return a copy of the specified dictionary or null if the argument is null.
 java.util.Enumeration elements()
          Returns an enumeration of the values in this dictionary.
 java.util.Enumeration enum()
          Returns an enumeration of the values in this dictionary.
 java.lang.Object get(int key)
          Return the value associated with the integer key.
 java.lang.Object get(java.lang.Object key)
          Return the value associated with the integer key.
 boolean isEmpty()
          Tests if this dictionary is empty.
 java.util.Enumeration keys()
          Returns an integer key enumeration of the keys in this dictionary.
 int[] keysAsArray()
          Returns an array containing all the keys of this dictionary.
 java.lang.Object put(int key, java.lang.Object value)
          Maps the specified key to the specified value in this dictionary.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Maps the specified key to the specified value in this dictionary.
 java.lang.Object remove(int key)
          Remove the key and its associated value from this dictionary.
 java.lang.Object remove(java.lang.Object key)
          Remove the key and its associated value from this dictionary.
 int size()
          Returns the number of entries in this dictionary.
 java.lang.String toString()
          Return the string representation of this dictionary.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerKeyDictionary

public IntegerKeyDictionary()

IntegerKeyDictionary

public IntegerKeyDictionary(int initialCapacity)
Parameters:
initialCapacity - int - the initial capacity of this dictionary.
Method Detail

add

public void add(int key,
                java.lang.Object value)
Maps the specified key to the specified value in this dictionary. The value can't be null.
Parameters:
key - int - the key.
value - Object - the value.
Throws:
NullPointerException - - if the value is null.

addAll

public void addAll(IntegerKeyDictionary d)
Add all of the entries in the argument dictionary to the current dictionary.
Parameters:
d - IntegerKeyDictionary - the dictionary to load.

addAll

public void addAll(java.util.Hashtable d)
Add all of the entries in the argument hash table to the current dictionary.
Parameters:
d - Hashtable - the hash table to load.

asDictionary

public Dictionary asDictionary()
Return a regular dictionary corresponding to this dictionary but using Integer keys rather than int keys.
Returns:
com.ibm.dse.applsrv.aa.Dictionary - a copy of this dictionary.

clear

public void clear()
Clears this dictionary so that it contains no elements.

clone

public java.lang.Object clone()
Creates a shallow copy of this dictionary. The keys and values themselves are not cloned. This is a relatively expensive operation.
Overrides:
clone in class java.lang.Object
Returns:
Object - a clone of the dictionary.

contains

public boolean contains(java.lang.Object value)
Tests if this dictionary contains the specified value. This operation is more expensive than the containsKey method.
Parameters:
value - Object - the value to search for.
Returns:
boolean - true if value was found else returns false.
Throws:
NullPointerException - - if the value is null.

containsKey

public boolean containsKey(int key)
Tests if the specified integer is a key in this dictionary.
Parameters:
key - int - the key to search for.
Returns:
boolean - true if the key was found in this dictionary else false.

copy

public IntegerKeyDictionary copy()
Creates a shallow copy of this dictionary.
Returns:
IntegerKeyDictionary - a copy of this dictionary.

copy

public static IntegerKeyDictionary copy(IntegerKeyDictionary aDictionary)
Return a copy of the specified dictionary or null if the argument is null.
Parameters:
aDictionary - IntegerKeyDictionary - the dictionary to copy or null.
Returns:
IntegerKeyDictionary - the copy of the dictionary or null.

elements

public java.util.Enumeration elements()
Returns an enumeration of the values in this dictionary. Use the Enumeration methods on the returned object to fetch the elements sequentially.
Overrides:
elements in class java.util.Dictionary
Returns:
Enumeration - an enumeration of the values in this dictionary.

enum

public java.util.Enumeration enum()
Returns an enumeration of the values in this dictionary. Use the Enumeration methods on the returned object to fetch the elements sequentially.
Returns:
Enumeration - an enumeration of the values in this dictionary.

get

public java.lang.Object get(int key)
Return the value associated with the integer key.
Parameters:
key - int - the key.
Returns:
Object - the value associated with the key or null if there is no value associated with the key.

get

public java.lang.Object get(java.lang.Object key)
Return the value associated with the integer key.
Overrides:
get in class java.util.Dictionary
Parameters:
key - Object - the key.
Returns:
Object - the value associated with the key or null if there is no value associated with the key.
Throws:
java.lang.IllegalArgumentException - - argument must be an integer.

isEmpty

public boolean isEmpty()
Tests if this dictionary is empty.
Overrides:
isEmpty in class java.util.Dictionary
Returns:
boolean - true if this dictionary is empty else false.

keys

public java.util.Enumeration keys()
Returns an integer key enumeration of the keys in this dictionary.
Overrides:
keys in class java.util.Dictionary
Returns:
Enumeration - an integer key enumeration of the keys in this dictionary.

keysAsArray

public int[] keysAsArray()
Returns an array containing all the keys of this dictionary.
Returns:
int[] - an array containing all the keys of this dictionary.

put

public java.lang.Object put(int key,
                            java.lang.Object value)
Maps the specified key to the specified value in this dictionary. The value can't be null.
Parameters:
key - int - the key.
value - Object - the value.
Returns:
Object - the previous value associated with this key or null if it did not have one.
Throws:
NullPointerException - - if the value is null.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Maps the specified key to the specified value in this dictionary. The value can't be null.
Overrides:
put in class java.util.Dictionary
Parameters:
key - Object - the key.
value - Object - the value.
Returns:
Object - the previous value associated with this key or null if it did not have one.
Throws:
NullPointerException - - if the value is null.
java.lang.IllegalArgumentException - - argument must be an integer.

remove

public java.lang.Object remove(int key)
Remove the key and its associated value from this dictionary. Return null if the key was not found.
Parameters:
key - int - the key to be removed.
Returns:
Object - the value associated with this key or null if it did not have one.

remove

public java.lang.Object remove(java.lang.Object key)
Remove the key and its associated value from this dictionary. Return null if the key was not found.
Overrides:
remove in class java.util.Dictionary
Parameters:
key - Object - the key to be removed.
Returns:
Object - the value associated with this key or null if it did not have one.
Throws:
java.lang.IllegalArgumentException - - argument must be an integer.

size

public int size()
Returns the number of entries in this dictionary.
Overrides:
size in class java.util.Dictionary
Returns:
int - the number of entries in this dictionary.

toString

public java.lang.String toString()
Return the string representation of this dictionary.
Overrides:
toString in class java.lang.Object
Returns:
String - the string representation of this dictionary.