Package sc.util

Class IntCoalescedHashMap

  • All Implemented Interfaces:, java.lang.Cloneable

    public class IntCoalescedHashMap
    extends java.lang.Object
    implements java.lang.Cloneable,
    This is a faster implementation of the basic operations for a table whose size is known roughly before populating, elements are never removed, hash functions are relatively good. No hash-table entries are created for adding a new item. Items are put into a slot based on their hash code. If that spot is filled, we start at the top of the list and put it in the first entry spot. So a full list can have O(N) insert and O(N) lookup. Resizing is expensive so avoid that.
    See Also:
    Serialized Form
    • Field Summary

      Modifier and Type Field Description
      int size  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(java.lang.Object key)  
      int get​(java.lang.Object key)  
      int put​(java.lang.Object key, int value)  
      void putAll​(IntCoalescedHashMap m)  
      • Methods inherited from class java.lang.Object

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

      • size

        public int size
    • Constructor Detail

      • IntCoalescedHashMap

        public IntCoalescedHashMap​(int size)
    • Method Detail

      • get

        public int get​(java.lang.Object key)
      • containsKey

        public boolean containsKey​(java.lang.Object key)
      • put

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