Class IntObjectHashtable<T>

java.lang.Object
ghidra.util.datastruct.IntObjectHashtable<T>
All Implemented Interfaces:
Serializable

public class IntObjectHashtable<T> extends Object implements Serializable
Class that implements a hashtable with int keys and Object values.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor creates a table with an initial default capacity.
    IntObjectHashtable(int capacity)
    Constructor creates a table with an initial given capacity.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(int key)
    Return true if the given key is in the hashtable.
    get(int key)
    Returns the value for the given key.
    int[]
    Returns an array containing all the int keys.
    void
    put(int key, T value)
    Adds a key/value pair to the hashtable.
    boolean
    remove(int key)
    Removes a key from the hashtable
    void
    Remove all entries from the hashtable.
    int
    Return the number of key/value pairs stored in the hashtable.

    Methods inherited from class java.lang.Object

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

    • IntObjectHashtable

      public IntObjectHashtable()
      Default constructor creates a table with an initial default capacity.
    • IntObjectHashtable

      public IntObjectHashtable(int capacity)
      Constructor creates a table with an initial given capacity. The capacity will be adjusted to the next highest prime in the PRIMES table.
      Parameters:
      capacity - the initial capacity.
  • Method Details

    • put

      public void put(int key, T value)
      Adds a key/value pair to the hashtable. If the key is already in the table, the old value is replaced with the new value. If the hashtable is already full, the hashtable will attempt to approximately double in size (it will use a prime number), and all the current entries will be rehashed.
      Parameters:
      key - the key to associate with the given value.
      value - the value to associate with the given key.
      Throws:
      ArrayIndexOutOfBoundsException - thrown if the maximum capacity is reached.
    • get

      public T get(int key)
      Returns the value for the given key.
      Parameters:
      key - the key whose associated value is to be returned.
    • remove

      public boolean remove(int key)
      Removes a key from the hashtable
      Parameters:
      key - key to be removed from the hashtable.
      Returns:
      true if key is found and removed, false otherwise.
    • removeAll

      public void removeAll()
      Remove all entries from the hashtable.
    • contains

      public boolean contains(int key)
      Return true if the given key is in the hashtable.
      Parameters:
      key - the key whose presence in this map is to be tested.
    • size

      public int size()
      Return the number of key/value pairs stored in the hashtable.
    • getKeys

      public int[] getKeys()
      Returns an array containing all the int keys.