Class HashTable

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    CharTable, ObjectTable

    public class HashTable
    extends java.lang.Object
    implements java.lang.Cloneable
    Restriction:
    This class is not intended to be subclassed by clients.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int currEntry  
      protected int[] hashTable  
      protected static int minHashSize
      Deprecated.
      Don't depend on this implementation detail.
      protected int[] nextTable  
    • Constructor Summary

      Constructors 
      Constructor Description
      HashTable​(int initialSize)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int capacity()  
      void clear()  
      java.lang.Object clone()  
      int countCollisions()
      Returns the number of collisions.
      void dumpNexts()
      For debugging only.
      protected int hash​(int pos)  
      boolean isEmpty()  
      protected void linkIntoHashTable​(int i, int hash)  
      protected int partition​(java.util.Comparator<java.lang.Object> c, int p, int r)  
      protected void rehash()  
      protected void removeEntry​(int i, int hash)  
      protected void resize()  
      protected void resize​(int size)  
      int size()  
      void sort​(java.util.Comparator<java.lang.Object> c)  
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • minHashSize

        @Deprecated
        protected static final int minHashSize
        Deprecated.
        Don't depend on this implementation detail. @noreference This field is not intended to be referenced by clients.
        See Also:
        Constant Field Values
      • currEntry

        protected int currEntry
      • hashTable

        protected int[] hashTable
      • nextTable

        protected int[] nextTable
    • Constructor Detail

      • HashTable

        public HashTable​(int initialSize)
    • Method Detail

      • isEmpty

        public boolean isEmpty()
      • size

        public final int size()
      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • resize

        protected void resize()
      • clear

        public void clear()
      • rehash

        protected void rehash()
      • resize

        protected void resize​(int size)
      • hash

        protected int hash​(int pos)
      • linkIntoHashTable

        protected final void linkIntoHashTable​(int i,
                                               int hash)
      • capacity

        public final int capacity()
      • removeEntry

        protected void removeEntry​(int i,
                                   int hash)
      • sort

        public final void sort​(java.util.Comparator<java.lang.Object> c)
      • partition

        protected int partition​(java.util.Comparator<java.lang.Object> c,
                                int p,
                                int r)
      • dumpNexts

        public void dumpNexts()
        For debugging only.
        Restriction:
        This method is not intended to be referenced by clients.
      • countCollisions

        public int countCollisions()
        Returns the number of collisions. For debugging only.
        Restriction:
        This method is not intended to be referenced by clients.