jv.thirdParty.acmeEncoders

## Class IntHashtable

- java.lang.Object
- - java.util.Dictionary
  - - jv.thirdParty.acmeEncoders.IntHashtable

- All Implemented Interfaces:
    java.lang.Cloneable

      public class IntHashtable
      extends java.util.Dictionary
      implements java.lang.Cloneable

  A Hashtable that uses ints as the keys.

  This is 90% based on JavaSoft's java.util.Hashtable. Use just like java.util.Hashtable, except that the keys must be ints. This is much faster than creating a new Integer for each access.

  Copyright (C)1996,1998 by Jef Poskanzer . All rights reserved.

  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

  Visit the ACME Labs Java page for up-to-date versions of this and other fine Java utilities: http://www.acme.com/java/

  See Also:
    `Hashtable`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IntHashtable()` Constructs a new, empty hashtable.
    `IntHashtable(int initialCapacity)` Constructs a new, empty hashtable with the specified initial capacity.
    `IntHashtable(int initialCapacity, float loadFactor)` Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Clears the hash table so that it has no more elements in it.
    `java.lang.Object` | `clone()` Creates a clone of the hashtable.
    `boolean` | `contains(java.lang.Object value)` Returns true if the specified object is an element of the hashtable.
    `boolean` | `containsKey(int key)` Returns true if the collection contains an element for the key.
    `java.util.Enumeration` | `elements()` Returns an enumeration of the elements.
    `java.lang.Object` | `get(int key)` Gets the object associated with the specified key in the hashtable.
    `java.lang.Object` | `get(java.lang.Object okey)` A get method that takes an Object, for compatibility with java.util.Dictionary.
    `boolean` | `isEmpty()` Returns true if the hashtable contains no elements.
    `java.util.Enumeration` | `keys()` Returns an enumeration of the hashtable's keys.
    `java.lang.Object` | `put(int key, java.lang.Object value)` Puts the specified element into the hashtable, using the specified key.
    `java.lang.Object` | `put(java.lang.Object okey, java.lang.Object value)` A put method that takes an Object, for compatibility with java.util.Dictionary.
    `java.lang.Object` | `remove(int key)` Removes the element corresponding to the key.
    `java.lang.Object` | `remove(java.lang.Object okey)` A remove method that takes an Object, for compatibility with java.util.Dictionary.
    `int` | `size()` Returns the number of elements contained in the hashtable.
    `java.lang.String` | `toString()` Converts to a rather lengthy String.

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

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### IntHashtable

          public IntHashtable(int initialCapacity,
                      float loadFactor)

      Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.
      Parameters:
        `initialCapacity` - the initial number of buckets
        `loadFactor` - a number between 0.0 and 1.0, it defines the threshold for rehashing the hashtable into a bigger one.
      Throws:
        `java.lang.IllegalArgumentException` - If the initial capacity is less than or equal to zero.
        `java.lang.IllegalArgumentException` - If the load factor is less than or equal to zero.

    - #### IntHashtable

          public IntHashtable(int initialCapacity)

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

    - #### IntHashtable

          public IntHashtable()

      Constructs a new, empty hashtable. A default capacity and load factor is used. Note that the hashtable will automatically grow when it gets full.

  - ### Method Detail

    - #### size

          public int size()

      Returns the number of elements contained in the hashtable.
      Specified by:
        `size` in class `java.util.Dictionary`

    - #### isEmpty

          public boolean isEmpty()

      Returns true if the hashtable contains no elements.
      Specified by:
        `isEmpty` in class `java.util.Dictionary`

    - #### keys

          public java.util.Enumeration keys()

      Returns an enumeration of the hashtable's keys.
      Specified by:
        `keys` in class `java.util.Dictionary`
      See Also:
        `elements()`

    - #### elements

          public java.util.Enumeration elements()

      Returns an enumeration of the elements. Use the Enumeration methods on the returned object to fetch the elements sequentially.
      Specified by:
        `elements` in class `java.util.Dictionary`
      See Also:
        `keys()`

    - #### contains

          public boolean contains(java.lang.Object value)

      Returns true if the specified object is an element of the hashtable. This operation is more expensive than the containsKey() method.
      Parameters:
        `value` - the value that we are looking for
      Throws:
        `java.lang.NullPointerException` - If the value being searched for is equal to null.
      See Also:
        `containsKey(int)`

    - #### containsKey

          public boolean containsKey(int key)

      Returns true if the collection contains an element for the key.
      Parameters:
        `key` - the key that we are looking for
      See Also:
        `contains(Object)`

    - #### get

          public java.lang.Object get(int key)

      Gets the object associated with the specified key in the hashtable.
      Parameters:
        `key` - the specified key
      Returns:
        the element for the key or null if the key is not defined in the hash table.
      See Also:
        `put(int, Object)`

    - #### get

          public java.lang.Object get(java.lang.Object okey)

      A get method that takes an Object, for compatibility with java.util.Dictionary. The Object must be an Integer.
      Specified by:
        `get` in class `java.util.Dictionary`

    - #### put

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

      Puts the specified element into the hashtable, using the specified key. The element may be retrieved by doing a get() with the same key. The key and the element cannot be null.
      Parameters:
        `key` - the specified key in the hashtable
        `value` - the specified element
      Returns:
        the old value of the key, or null if it did not have one.
      Throws:
        `java.lang.NullPointerException` - If the value of the element is equal to null.
      See Also:
        `get(Object)`, `get(int)`

    - #### put

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

      A put method that takes an Object, for compatibility with java.util.Dictionary. The Object must be an Integer.
      Specified by:
        `put` in class `java.util.Dictionary`

    - #### remove

          public java.lang.Object remove(int key)

      Removes the element corresponding to the key. Does nothing if the key is not present.
      Parameters:
        `key` - the key that needs to be removed
      Returns:
        the value of key, or null if the key was not found.

    - #### remove

          public java.lang.Object remove(java.lang.Object okey)

      A remove method that takes an Object, for compatibility with java.util.Dictionary. The Object must be an Integer.
      Specified by:
        `remove` in class `java.util.Dictionary`

    - #### clear

          public void clear()

      Clears the hash table so that it has no more elements in it.

    - #### clone

          public java.lang.Object clone()

      Creates a clone of the hashtable. A shallow copy is made, the keys and elements themselves are NOT cloned. This is a relatively expensive operation.
      Overrides:
        `clone` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Converts to a rather lengthy String.
      Overrides:
        `toString` in class `java.lang.Object`

"

The software JavaView? is copyright protected. All Rights Reserved.
"