org.apache.commons.collections.map

Class IdentityMap<K,V>

    • Constructor Detail

      • IdentityMap

        public IdentityMap()
        Constructs a new empty map with default size and load factor.
      • IdentityMap

        public IdentityMap(int initialCapacity)
        Constructs a new, empty map with the specified initial capacity.
        Parameters:
        initialCapacity - the initial capacity
        Throws:
        IllegalArgumentException - if the initial capacity is negative
      • IdentityMap

        public IdentityMap(int initialCapacity,
                   float loadFactor)
        Constructs a new, empty map with the specified initial capacity and load factor.
        Parameters:
        initialCapacity - the initial capacity
        loadFactor - the load factor
        Throws:
        IllegalArgumentException - if the initial capacity is negative
        IllegalArgumentException - if the load factor is less than zero
    • Method Detail

      • hash

        protected int hash(Object key)
        Gets the hash code for the key specified. This implementation uses the identity hash code.
        Overrides:
        hash in class AbstractHashedMap<K,V>
        Parameters:
        key - the key to get a hash code for
        Returns:
        the hash code
      • isEqualKey

        protected boolean isEqualKey(Object key1,
                         Object key2)
        Compares two keys for equals. This implementation uses ==.
        Overrides:
        isEqualKey in class AbstractHashedMap<K,V>
        Parameters:
        key1 - the first key to compare
        key2 - the second key to compare
        Returns:
        true if equal by identity
      • isEqualValue

        protected boolean isEqualValue(Object value1,
                           Object value2)
        Compares two values for equals. This implementation uses ==.
        Overrides:
        isEqualValue in class AbstractHashedMap<K,V>
        Parameters:
        value1 - the first value to compare
        value2 - the second value to compare
        Returns:
        true if equal by identity

Copyright © 2001-2013 The Apache Software Foundation. All Rights Reserved.