Class IntHashtable

java.lang.Object
org.openpdf.text.pdf.IntHashtable
All Implemented Interfaces:
Cloneable

public class IntHashtable extends Object implements Cloneable

A hash map that uses primitive ints for the key rather than objects.

Note that this class is for internal optimization purposes only, and may not be supported in future releases of Jakarta Commons Lang. Utilities of this sort may be included in future releases of Jakarta Commons Collections.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new, empty hashtable with a default capacity and load factor, which is 20 and 0.75 respectively.
    IntHashtable(int initialCapacity, float loadFactor)
    Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    boolean
    containsKey(int key)
    Tests if the specified int is a key in this hashtable.
    int
    get(int key)
    Returns the value to which the specified key is mapped in this map.
    boolean
    Tests if this hashtable maps no keys to values.
    int
    put(int key, int value)
    Maps the specified key to the specified value in this hashtable.
    protected void
    Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IntHashtable

      public IntHashtable()

      Constructs a new, empty hashtable with a default capacity and load factor, which is 20 and 0.75 respectively.

    • 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 capacity of the hashtable.
      loadFactor - the load factor of the hashtable.
      Throws:
      IllegalArgumentException - if the initial capacity is less than zero, or if the load factor is nonpositive.
  • Method Details

    • isEmpty

      public boolean isEmpty()

      Tests if this hashtable maps no keys to values.

      Returns:
      true if this hashtable maps no keys to values; false otherwise.
    • containsKey

      public boolean containsKey(int key)

      Tests if the specified int is a key in this hashtable.

      Parameters:
      key - possible key.
      Returns:
      true if and only if the specified int is a key in this hashtable, as determined by the equals method; false otherwise.
    • get

      public int get(int key)

      Returns the value to which the specified key is mapped in this map.

      Parameters:
      key - a key in the hashtable.
      Returns:
      the value to which the key is mapped in this hashtable; null if the key is not mapped to any value in this hashtable.
      See Also:
    • rehash

      protected void rehash()

      Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently.

      This method is called automatically when the number of keys in the hashtable exceeds this hashtable's capacity and load factor.

    • put

      public int put(int key, int value)

      Maps the specified key to the specified value in this hashtable. The key cannot be null.

      The value can be retrieved by calling the get method with a key that is equal to the original key.

      Parameters:
      key - the hashtable key.
      value - the value.
      Returns:
      the previous value of the specified key in this hashtable, or null if it did not have one.
      Throws:
      NullPointerException - if the key is null.
      See Also:
    • clone

      public Object clone()
      Overrides:
      clone in class Object