Class PackedMap<K,​V>

  • Type Parameters:
    K - the type of keys maintained by this map.
    V - the type of mapped values.

    public class PackedMap<K,​V>
    extends AbstractPackedMap<K,​V>
    This class implements the AbstractPackedMap class, using object-equality when comparing keys. In other words, in an PackedMap, two keys k1 and k2 are considered equal if and only if (k1.equals(k2)) (with k1 not null for sure as long as this map does not accept null keys).
    • Constructor Detail

      • PackedMap

        public PackedMap()
        Constructs an empty map.
      • PackedMap

        public PackedMap​(PackedMap<K,​V> map)
        Constructs a map with the same mappings as the specified map.
        Parameters:
        map - the map whose mappings are to be placed in this map.
        Throws:
        NullPointerException - if the specified map is null.
    • Method Detail

      • clone

        public Object clone()
        Description copied from class: AbstractPackedMap
        Returns a shallow copy of this map instance: the keys and values themselves are not cloned.
        Specified by:
        clone in class AbstractPackedMap<K,​V>
        Returns:
        a shallow copy of this map
        See Also:
        Cloneable
      • isSame

        protected boolean isSame​(Object key,
                                 @Nullable
                                 Object candidateKey)
        Description copied from class: AbstractPackedMap
        Checks whether two keys are equal or not. The key must not be null.
        Specified by:
        isSame in class AbstractPackedMap<K,​V>
        Parameters:
        key - the key searched in the map.
        candidateKey - the key in the map to compare with. Can be null if and only if AbstractPackedMap.unwrapKey(Object) implementation can return null.
        Returns:
        true if the two keys are equal, false otherwise.