## org.flexdock.util
Class TypedHashtable

    java.lang.Object
      java.util.Dictionary<K,V>
          java.util.Hashtable
              org.flexdock.util.TypedHashtable

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, java.util.Map

Direct Known Subclasses:
  BasicDockablePropertySet, BasicDockingPortPropertySet

    public class TypedHashtable

extends java.util.Hashtable

Author:
  Christopher Butler
See Also:
  Serialized Form

Constructor Summary
`TypedHashtable()` Constructs a new, empty `TypedHashtable` with a default initial capacity (11) and load factor of `0.75`.
`TypedHashtable(int initialCapacity)` Constructs a new, empty `TypedHashtable` with the specified initial capacity and default load factor of `0.75`.
`TypedHashtable(int initialCapacity, float loadFactor)` Constructs a new, empty `TypedHashtable` with the specified initial capacity and the specified load factor.
`TypedHashtable(java.util.Map t)` Constructs a new `TypedHashtable` with the same mappings as the given Map.

Method Summary
`boolean` `get(java.lang.Object key, boolean defaultValue)` Returns the boolean value associated with the specified `key` in this hashtable.
`byte` `get(java.lang.Object key, byte defaultValue)` Returns the byte value associated with the specified `key` in this hashtable.
`char` `get(java.lang.Object key, char defaultValue)` Returns the char value associated with the specified `key` in this hashtable.
`double` `get(java.lang.Object key, double defaultValue)` Returns the double value associated with the specified `key` in this hashtable.
`float` `get(java.lang.Object key, float defaultValue)` Returns the float value associated with the specified `key` in this hashtable.
`int` `get(java.lang.Object key, int defaultValue)` Returns the int value associated with the specified `key` in this hashtable.
`long` `get(java.lang.Object key, long defaultValue)` Returns the long value associated with the specified `key` in this hashtable.
`short` `get(java.lang.Object key, short defaultValue)` Returns the short value associated with the specified `key` in this hashtable.
`java.lang.Boolean` `getBoolean(java.lang.Object key)` Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Boolean` before returning.
`java.lang.Byte` `getByte(java.lang.Object key)` Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Byte` before returning.
`java.lang.Character` `getChar(java.lang.Object key)` Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Character` before returning.
`java.lang.Double` `getDouble(java.lang.Object key)` Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Double` before returning.
`java.lang.Float` `getFloat(java.lang.Object key)` Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Float` before returning.
`java.lang.Integer` `getInt(java.lang.Object key)` Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Integer` before returning.
`java.lang.Long` `getLong(java.lang.Object key)` Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Long` before returning.
`java.lang.Short` `getShort(java.lang.Object key)` Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Short` before returning.
`java.lang.String` `getString(java.lang.Object key)` Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.String` before returning.
`void` `put(java.lang.Object key, boolean value)` Maps the specified `key` to the specified boolean `value` in this hashtable.
`void` `put(java.lang.Object key, byte value)` Maps the specified `key` to the specified byte `value` in this hashtable.
`void` `put(java.lang.Object key, char value)` Maps the specified `key` to the specified char `value` in this hashtable.
`void` `put(java.lang.Object key, double value)` Maps the specified `key` to the specified double `value` in this hashtable.
`void` `put(java.lang.Object key, float value)` Maps the specified `key` to the specified float `value` in this hashtable.
`void` `put(java.lang.Object key, int value)` Maps the specified `key` to the specified int `value` in this hashtable.
`void` `put(java.lang.Object key, long value)` Maps the specified `key` to the specified long `value` in this hashtable.
`java.lang.Object` `put(java.lang.Object key, java.lang.Object value)` Maps the specified `key` to the specified `value` in this hashtable.
`void` `put(java.lang.Object key, short value)` Maps the specified `key` to the specified short `value` in this hashtable.

Methods inherited from class java.util.Hashtable
`clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, remove, size, toString, values`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### TypedHashtable

    public TypedHashtable()

  Constructs a new, empty `TypedHashtable` with a default initial capacity (11) and load factor of `0.75`.

### TypedHashtable

    public TypedHashtable(int initialCapacity)

  Constructs a new, empty `TypedHashtable` with the specified initial capacity and default load factor of `0.75`.

  Parameters:
    `initialCapacity` - the initial capacity of the hashtable.
  Throws:
    `java.lang.IllegalArgumentException` - if the initial capacity is less than zero.

### TypedHashtable

    public TypedHashtable(int initialCapacity,
                          float loadFactor)

  Constructs a new, empty `TypedHashtable` with the specified initial capacity and the specified load factor.

  Parameters:
    `initialCapacity` - the initial capacity of the hashtable.
    `loadFactor` - the load factor of the hashtable.
  Throws:
    `java.lang.IllegalArgumentException` - if the initial capacity is less than zero, or if the load factor is nonpositive.

### TypedHashtable

    public TypedHashtable(java.util.Map t)

  Constructs a new `TypedHashtable` with the same mappings as the given Map. The hashtable is created with an initial capacity sufficient to hold the mappings in the given Map and a default load factor of `0.75`.

  Parameters:
    `t` - the map whose mappings are to be placed in this map.
  Throws:
    `java.lang.NullPointerException` - if the specified map is null.

Method Detail

### put

    public void put(java.lang.Object key,
                    boolean value)

  Maps the specified `key` to the specified boolean `value` in this hashtable. Since hashtables require `Object` values, this method will put either `Boolean.TRUE` or `Boolean.FALSE` in the hashtable. If `key` is `null` then this method returns with no action taken.

  Parameters:
    `key` - the hashtable key.
    `value` - the boolean value to be mapped to the specified `key`.
  See Also:
    `Boolean.TRUE`, `Boolean.FALSE`, `put(Object, Object)`

### put

    public void put(java.lang.Object key,
                    byte value)

  Maps the specified `key` to the specified byte `value` in this hashtable. Since hashtables require `Object` values, this method will wrap the specified byte in a `java.lang.Byte` before inserting. If `key` is `null` then this method returns with no action taken.

  Parameters:
    `key` - the hashtable key.
    `value` - the byte value to be mapped to the specified `key`.
  See Also:
    `Byte.Byte(byte)`, `put(Object, Object)`

### put

    public void put(java.lang.Object key,
                    short value)

  Maps the specified `key` to the specified short `value` in this hashtable. Since hashtables require `Object` values, this method will wrap the specified short in a `java.lang.Short` before inserting. If `key` is `null` then this method returns with no action taken.

  Parameters:
    `key` - the hashtable key.
    `value` - the short value to be mapped to the specified `key`.
  See Also:
    `Short.Short(short)`, `put(Object, Object)`

### put

    public void put(java.lang.Object key,
                    int value)

  Maps the specified `key` to the specified int `value` in this hashtable. Since hashtables require `Object` values, this method will wrap the specified int in a `java.lang.Integer` before inserting. If `key` is `null` then this method returns with no action taken.

  Parameters:
    `key` - the hashtable key.
    `value` - the int value to be mapped to the specified `key`.
  See Also:
    `Integer.Integer(int)`, `put(Object, Object)`

### put

    public void put(java.lang.Object key,
                    long value)

  Maps the specified `key` to the specified long `value` in this hashtable. Since hashtables require `Object` values, this method will wrap the specified long in a `java.lang.Long` before inserting. If `key` is `null` then this method returns with no action taken.

  Parameters:
    `key` - the hashtable key.
    `value` - the long value to be mapped to the specified `key`.
  See Also:
    `Long.Long(long)`, `put(Object, Object)`

### put

    public void put(java.lang.Object key,
                    float value)

  Maps the specified `key` to the specified float `value` in this hashtable. Since hashtables require `Object` values, this method will wrap the specified float in a `java.lang.Float` before inserting. If `key` is `null` then this method returns with no action taken.

  Parameters:
    `key` - the hashtable key.
    `value` - the float value to be mapped to the specified `key`.
  See Also:
    `Float.Float(float)`, `put(Object, Object)`

### put

    public void put(java.lang.Object key,
                    double value)

  Maps the specified `key` to the specified double `value` in this hashtable. Since hashtables require `Object` values, this method will wrap the specified double in a `java.lang.Double` before inserting. If `key` is `null` then this method returns with no action taken.

  Parameters:
    `key` - the hashtable key.
    `value` - the double value to be mapped to the specified `key`.
  See Also:
    `Double.Double(double)`, `put(Object, Object)`

### put

    public void put(java.lang.Object key,
                    char value)

  Maps the specified `key` to the specified char `value` in this hashtable. Since hashtables require `Object` values, this method will wrap the specified char in a `java.lang.Character` before inserting. If `key` is `null` then this method returns with no action taken.

  Parameters:
    `key` - the hashtable key.
    `value` - the char value to be mapped to the specified `key`.
  See Also:
    `Character.Character(char)`, `put(Object, Object)`

### put

    public java.lang.Object put(java.lang.Object key,
                                java.lang.Object value)

  Maps the specified `key` to the specified `value` in this hashtable. If the `key` is `null`, then this method returns with no action taken. If the `value` is `null`, then this method removes any existing mapping in the hashtable for the specified `key` by calling `remove(Object key)`. The value can be retrieved by calling the `get(Object key)` method with a key that is equal to the original key.

  Specified by:
    `put` in interface `java.util.Map`
  Overrides:
    `put` in class `java.util.Hashtable`
  Parameters:
    `key` - the hashtable key.
    `value` - the value.
  See Also:
    `Object.equals(Object)`, `Hashtable.get(Object)`, `Hashtable.remove(java.lang.Object)`

### get

    public boolean get(java.lang.Object key,
                       boolean defaultValue)

  Returns the boolean value associated with the specified `key` in this hashtable. This method attempts to cast the value in this hashtable for the specified `key` to a `java.lang.Boolean` and invoke its `booleanValue()` method. If the key does not exist in the hashtable, or it maps to a non-`Boolean` value, then this method returns the specified `defaultValue`.

  Parameters:
    `key` - the hashtable key
    `defaultValue` - the value to return if a valid boolean cannot be found for the specified key
  Returns:
    the boolean value associated with the specified `key` in this hashtable.
  See Also:
    `put(Object, boolean)`, `getBoolean(Object)`, `Boolean.booleanValue()`

### get

    public byte get(java.lang.Object key,
                    byte defaultValue)

  Returns the byte value associated with the specified `key` in this hashtable. This method attempts to cast the value in this hashtable for the specified `key` to a `java.lang.Byte` and invoke its `byteValue()` method. If the key does not exist in the hashtable, or it maps to a non-`Byte` value, then this method returns the specified `defaultValue`.

  Parameters:
    `key` - the hashtable key
    `defaultValue` - the value to return if a valid byte cannot be found for the specified key
  Returns:
    the byte value associated with the specified `key` in this hashtable.
  See Also:
    `put(Object, byte)`, `getByte(Object)`, `Byte.byteValue()`

### get

    public short get(java.lang.Object key,
                     short defaultValue)

  Returns the short value associated with the specified `key` in this hashtable. This method attempts to cast the value in this hashtable for the specified `key` to a `java.lang.Short` and invoke its `shortValue()` method. If the key does not exist in the hashtable, or it maps to a non-`Short` value, then this method returns the specified `defaultValue`.

  Parameters:
    `key` - the hashtable key
    `defaultValue` - the value to return if a valid short cannot be found for the specified key
  Returns:
    the short value associated with the specified `key` in this hashtable.
  See Also:
    `put(Object, short)`, `getShort(Object)`, `Short.shortValue()`

### get

    public int get(java.lang.Object key,
                   int defaultValue)

  Returns the int value associated with the specified `key` in this hashtable. This method attempts to cast the value in this hashtable for the specified `key` to a `java.lang.Integer` and invoke its `intValue()` method. If the key does not exist in the hashtable, or it maps to a non-`Integer` value, then this method returns the specified `defaultValue`.

  Parameters:
    `key` - the hashtable key
    `defaultValue` - the value to return if a valid int cannot be found for the specified key
  Returns:
    the int value associated with the specified `key` in this hashtable.
  See Also:
    `put(Object, int)`, `getInt(Object)`, `Integer.intValue()`

### get

    public long get(java.lang.Object key,
                    long defaultValue)

  Returns the long value associated with the specified `key` in this hashtable. This method attempts to cast the value in this hashtable for the specified `key` to a `java.lang.Long` and invoke its `longValue()` method. If the key does not exist in the hashtable, or it maps to a non-`Long` value, then this method returns the specified `defaultValue`.

  Parameters:
    `key` - the hashtable key
    `defaultValue` - the value to return if a valid long cannot be found for the specified key
  Returns:
    the long value associated with the specified `key` in this hashtable.
  See Also:
    `put(Object, long)`, `getLong(Object)`, `Long.longValue()`

### get

    public float get(java.lang.Object key,
                     float defaultValue)

  Returns the float value associated with the specified `key` in this hashtable. This method attempts to cast the value in this hashtable for the specified `key` to a `java.lang.Float` and invoke its `floatValue()` method. If the key does not exist in the hashtable, or it maps to a non-`Float` value, then this method returns the specified `defaultValue`.

  Parameters:
    `key` - the hashtable key
    `defaultValue` - the value to return if a valid float cannot be found for the specified key
  Returns:
    the float value associated with the specified `key` in this hashtable.
  See Also:
    `put(Object, float)`, `getFloat(Object)`, `Float.floatValue()`

### get

    public double get(java.lang.Object key,
                      double defaultValue)

  Returns the double value associated with the specified `key` in this hashtable. This method attempts to cast the value in this hashtable for the specified `key` to a `java.lang.Double` and invoke its `doubleValue()` method. If the key does not exist in the hashtable, or it maps to a non-`Double` value, then this method returns the specified `defaultValue`.

  Parameters:
    `key` - the hashtable key
    `defaultValue` - the value to return if a valid double cannot be found for the specified key
  Returns:
    the double value associated with the specified `key` in this hashtable.
  See Also:
    `put(Object, double)`, `getDouble(Object)`, `Double.doubleValue()`

### get

    public char get(java.lang.Object key,
                    char defaultValue)

  Returns the char value associated with the specified `key` in this hashtable. This method attempts to cast the value in this hashtable for the specified `key` to a `java.lang.Character` and invoke its `charValue()` method. If the key does not exist in the hashtable, or it maps to a non-`Character` value, then this method returns the specified `defaultValue`.

  Parameters:
    `key` - the hashtable key
    `defaultValue` - the value to return if a valid char cannot be found for the specified key
  Returns:
    the char value associated with the specified `key` in this hashtable.
  See Also:
    `put(Object, char)`, `getChar(Object)`, `Character.charValue()`

### getString

    public java.lang.String getString(java.lang.Object key)

  Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.String` before returning. If the specified `key` maps to an object type other than a `String` value, then this method throws a `ClassCastException`.

  Parameters:
    `key` - a key in the hashtable.
  Returns:
    the `String` value to which the key is mapped in this hashtable; `null` if the key is not mapped to any value in this hashtable.
  Throws:
    `java.lang.NullPointerException` - if the key is `null`.
    `java.lang.ClassCastException` - if the returns value is not a `String`
  See Also:
    `put(Object, Object)`

### getBoolean

    public java.lang.Boolean getBoolean(java.lang.Object key)

  Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Boolean` before returning. If the specified `key` maps to an object type other than a `Boolean` value, then this method throws a `ClassCastException`.

  Parameters:
    `key` - a key in the hashtable.
  Returns:
    the `Boolean` value to which the key is mapped in this hashtable; `null` if the key is not mapped to any value in this hashtable.
  Throws:
    `java.lang.NullPointerException` - if the key is `null`.
    `java.lang.ClassCastException` - if the returns value is not a `Boolean`
  See Also:
    `put(Object, Object)`

### getByte

    public java.lang.Byte getByte(java.lang.Object key)

  Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Byte` before returning. If the specified `key` maps to an object type other than a `Byte` value, then this method throws a `ClassCastException`.

  Parameters:
    `key` - a key in the hashtable.
  Returns:
    the `Byte` value to which the key is mapped in this hashtable; `null` if the key is not mapped to any value in this hashtable.
  Throws:
    `java.lang.NullPointerException` - if the key is `null`.
    `java.lang.ClassCastException` - if the returns value is not a `Byte`
  See Also:
    `put(Object, Object)`

### getShort

    public java.lang.Short getShort(java.lang.Object key)

  Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Short` before returning. If the specified `key` maps to an object type other than a `Short` value, then this method throws a `ClassCastException`.

  Parameters:
    `key` - a key in the hashtable.
  Returns:
    the `Short` value to which the key is mapped in this hashtable; `null` if the key is not mapped to any value in this hashtable.
  Throws:
    `java.lang.NullPointerException` - if the key is `null`.
    `java.lang.ClassCastException` - if the returns value is not a `Short`
  See Also:
    `put(Object, Object)`

### getInt

    public java.lang.Integer getInt(java.lang.Object key)

  Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Integer` before returning. If the specified `key` maps to an object type other than a `Integer` value, then this method throws a `ClassCastException`.

  Parameters:
    `key` - a key in the hashtable.
  Returns:
    the `Integer` value to which the key is mapped in this hashtable; `null` if the key is not mapped to any value in this hashtable.
  Throws:
    `java.lang.NullPointerException` - if the key is `null`.
    `java.lang.ClassCastException` - if the returns value is not a `Integer`
  See Also:
    `put(Object, Object)`

### getLong

    public java.lang.Long getLong(java.lang.Object key)

  Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Long` before returning. If the specified `key` maps to an object type other than a `Long` value, then this method throws a `ClassCastException`.

  Parameters:
    `key` - a key in the hashtable.
  Returns:
    the `Long` value to which the key is mapped in this hashtable; `null` if the key is not mapped to any value in this hashtable.
  Throws:
    `java.lang.NullPointerException` - if the key is `null`.
    `java.lang.ClassCastException` - if the returns value is not a `Long`
  See Also:
    `put(Object, Object)`

### getFloat

    public java.lang.Float getFloat(java.lang.Object key)

  Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Float` before returning. If the specified `key` maps to an object type other than a `Float` value, then this method throws a `ClassCastException`.

  Parameters:
    `key` - a key in the hashtable.
  Returns:
    the `Float` value to which the key is mapped in this hashtable; `null` if the key is not mapped to any value in this hashtable.
  Throws:
    `java.lang.NullPointerException` - if the key is `null`.
    `java.lang.ClassCastException` - if the returns value is not a `Float`
  See Also:
    `put(Object, Object)`

### getDouble

    public java.lang.Double getDouble(java.lang.Object key)

  Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Double` before returning. If the specified `key` maps to an object type other than a `Double` value, then this method throws a `ClassCastException`.

  Parameters:
    `key` - a key in the hashtable.
  Returns:
    the `Double` value to which the key is mapped in this hashtable; `null` if the key is not mapped to any value in this hashtable.
  Throws:
    `java.lang.NullPointerException` - if the key is `null`.
    `java.lang.ClassCastException` - if the returns value is not a `Double`
  See Also:
    `put(Object, Object)`

### getChar

    public java.lang.Character getChar(java.lang.Object key)

  Retrieves the value to which the specified key is mapped in this hashtable and casts to a `java.lang.Character` before returning. If the specified `key` maps to an object type other than a `Character` value, then this method throws a `ClassCastException`.

  Parameters:
    `key` - a key in the hashtable.
  Returns:
    the `Character` value to which the key is mapped in this hashtable; `null` if the key is not mapped to any value in this hashtable.
  Throws:
    `java.lang.NullPointerException` - if the key is `null`.
    `java.lang.ClassCastException` - if the returns value is not a `Character`
  See Also:
    `put(Object, Object)`