Package ej.bon

## Class WeakHashtable

- java.lang.Object
- - java.util.Dictionary<K,​V>
  - - java.util.Hashtable
    - - ej.bon.WeakHashtable

- All Implemented Interfaces:
    `Serializable`, `Cloneable`, `Map`

      public class WeakHashtable
      extends Hashtable

  A `Hashtable` implementation with weak keys. An entry in a `WeakHashtable` will automatically be removed when its key is no longer in ordinary use. More precisely, the presence of a mapping for a given key will not prevent the key from being discarded by the garbage collector and then reclaimed. When a key has been discarded its entry is effectively removed from the hashtable, so this class behaves somewhat differently from `Hashtable` implementation.

  Each key object in a `WeakHashtable` is stored indirectly as the referent of a weak reference. Therefore a key will automatically be removed only after the weak references to it, both inside and outside of the map, have been cleared by the garbage collector.

  Implementation note: The value objects in a `WeakHashtable` are held by ordinary strong references. Thus care should be taken to ensure that value objects do not strongly refer to their own keys, either directly or indirectly, since that will prevent the keys from being discarded.

  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry<K,​V>`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `WeakHashtable()` | Constructs a new, empty weak hashtable with a default capacity and load factor.
    `WeakHashtable​(int initialCapacity)` | Constructs a new, empty weak hashtable with the specified initial capacity.

  - ### Method Summary

    - ### Methods inherited from class java.util.Hashtable

      `clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### WeakHashtable

          public WeakHashtable()

      Constructs a new, empty weak hashtable with a default capacity and load factor.

    - #### WeakHashtable

          public WeakHashtable​(int initialCapacity)

      Constructs a new, empty weak hashtable with the specified initial capacity.
      Parameters:
        `initialCapacity` - the initial capacity of the hashtable.