Class TObjectByteHashMap<K>

    • Field Detail

      • _values

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

        protected byte no_entry_value
        the value that represents null
    • Constructor Detail

      • TObjectByteHashMap

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

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

        public TObjectByteHashMap(int initialCapacity,
                                  float loadFactor)
        Creates a new TObjectByteHashMap 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
      • TObjectByteHashMap

        public TObjectByteHashMap(int initialCapacity,
                                  float loadFactor,
                                  byte noEntryValue)
        Creates a new TObjectByteHashMap 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.
      • TObjectByteHashMap

        public TObjectByteHashMap(TObjectByteMap<? extends K> map)
        Creates a new TObjectByteHashMap that contains the entries in the map passed to it.
        Parameters:
        map - the TObjectByteMap 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 byte getNoEntryValue()
      • containsKey

        public boolean containsKey(Object key)
      • containsValue

        public boolean containsValue(byte val)
      • get

        public byte get(Object key)
      • put

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

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

        public byte 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 Byte> map)
      • clear

        public void clear()
      • keySet

        public Set<K> keySet()
      • keys

        public Object[] keys()
      • keys

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

        public byte[] values()
      • values

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

        public boolean increment(K key)
      • adjustValue

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

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

        public boolean forEachKey(TObjectProcedure<? super K> procedure)
        Executes procedure for each key in the map.
        Specified by:
        forEachKey in interface  TObjectByteMap<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(TByteProcedure procedure)
        Executes procedure for each value in the map.
        Specified by:
        forEachValue in interface  TObjectByteMap<K>
        Parameters:
        procedure - a TByteProcedure value
        Returns:
        false if the loop over the values terminated because the procedure returned false for some value.
      • forEachEntry

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

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

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

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

        public int hashCode()
      • toString

        public String toString()