Class TObjectIntHashMap<K>

    • Field Detail

      • _values

        protected transient int[] _values
        the values of the map
      • no_entry_value

        protected int no_entry_value
        the value that represents null
    • Constructor Detail

      • TObjectIntHashMap

        public TObjectIntHashMap()
        Creates a new TObjectIntHashMap instance with the default capacity and load factor.
      • TObjectIntHashMap

        public TObjectIntHashMap(int initialCapacity)
        Creates a new TObjectIntHashMap instance with a prime capacity equal to or greater than initialCapacity and with the default load factor.
        Parameters:
        initialCapacity - an int value
      • TObjectIntHashMap

        public TObjectIntHashMap(int initialCapacity,
                                 float loadFactor)
        Creates a new TObjectIntHashMap instance with a prime capacity equal to or greater than initialCapacity and with the specified load factor.
        Parameters:
        initialCapacity - an int value
        loadFactor - a float value
      • TObjectIntHashMap

        public TObjectIntHashMap(int initialCapacity,
                                 float loadFactor,
                                 int noEntryValue)
        Creates a new TObjectIntHashMap instance with a prime value at or near the specified capacity and load factor.
        Parameters:
        initialCapacity - used to find a prime capacity for the table.
        loadFactor - used to calculate the threshold over which rehashing takes place.
        noEntryValue - the value used to represent null.
      • TObjectIntHashMap

        public TObjectIntHashMap(TObjectIntMap<? extends K> map)
        Creates a new TObjectIntHashMap that contains the entries in the map passed to it.
        Parameters:
        map - the TObjectIntMap to be copied.
    • Method Detail

      • setUp

        public int setUp(int initialCapacity)
        initializes the hashtable to a prime capacity which is at least initialCapacity + 1.
        Overrides:
        setUp in class  TObjectHash<K>
        Parameters:
        initialCapacity - an int value
        Returns:
        the actual capacity chosen
      • rehash

        protected void rehash(int newCapacity)
        rehashes the map to the new capacity.
        Specified by:
        rehash in class  THash
        Parameters:
        newCapacity - an int value
      • getNoEntryValue

        public int getNoEntryValue()
      • containsKey

        public boolean containsKey(Object key)
      • containsValue

        public boolean containsValue(int val)
      • get

        public int get(Object key)
      • put

        public int put(K key,
                       int value)
      • putIfAbsent

        public int putIfAbsent(K key,
                               int value)
      • remove

        public int remove(Object key)
      • removeAt

        protected void removeAt(int index)
        Removes the mapping at index from the map. This method is used internally and public mainly because of packaging reasons. Caveat Programmer.
        Overrides:
        removeAt in class  TObjectHash<K>
        Parameters:
        index - an int value
      • putAll

        public void putAll(Map<? extends K,? extends Integer> map)
      • clear

        public void clear()
      • keySet

        public Set<K> keySet()
      • keys

        public Object[] keys()
      • keys

        public K[] keys(K[] a)
      • values

        public int[] values()
      • values

        public int[] values(int[] array)
      • increment

        public boolean increment(K key)
      • adjustValue

        public boolean adjustValue(K key,
                                   int amount)
      • adjustOrPutValue

        public int adjustOrPutValue(K key,
                                    int adjust_amount,
                                    int put_amount)
      • forEachKey

        public boolean forEachKey(TObjectProcedure<? super K> procedure)
        Executes procedure for each key in the map.
        Specified by:
        forEachKey in interface  TObjectIntMap<K>
        Parameters:
        procedure - a TObjectProcedure value
        Returns:
        false if the loop over the keys terminated because the procedure returned false for some key.
      • forEachValue

        public boolean forEachValue(TIntProcedure procedure)
        Executes procedure for each value in the map.
        Specified by:
        forEachValue in interface  TObjectIntMap<K>
        Parameters:
        procedure - a TIntProcedure value
        Returns:
        false if the loop over the values terminated because the procedure returned false for some value.
      • forEachEntry

        public boolean forEachEntry(TObjectIntProcedure<? super K> procedure)
        Executes procedure for each key/value entry in the map.
        Specified by:
        forEachEntry in interface  TObjectIntMap<K>
        Parameters:
        procedure - a TOObjectIntProcedure value
        Returns:
        false if the loop over the entries terminated because the procedure returned false for some entry.
      • retainEntries

        public boolean retainEntries(TObjectIntProcedure<? super K> procedure)
        Retains only those entries in the map for which the procedure returns a true value.
        Specified by:
        retainEntries in interface  TObjectIntMap<K>
        Parameters:
        procedure - determines which entries to keep
        Returns:
        true if the map was modified.
      • transformValues

        public void transformValues(TIntFunction function)
        Transform the values in this map using function.
        Specified by:
        transformValues in interface  TObjectIntMap<K>
        Parameters:
        function - a TIntFunction value
      • equals

        public boolean equals(Object other)
        Compares this map with another map for equality of their stored entries.
        Specified by:
        equals in interface  TObjectIntMap<K>
        Overrides:
        equals in class  Object
        Parameters:
        other - an Object value
        Returns:
        a boolean value
      • hashCode

        public int hashCode()
      • toString

        public String toString()