OrderedHashMap
org.clapper.util.misc

Class OrderedHashMap<K,V>

  • All Implemented Interfaces:
    Serializable, Cloneable, Map<K,V>

    Deprecated. 
    Please use java.util.LinkedHashMap, instead

    public class OrderedHashMap<K,V>extends HashMap<K,V>implements Cloneable, Serializable

    An OrderedHashMap is a java.util.HashMap with one additional property: It maintains a list of the map's keys in the order they were added to the map. This additional capability imposes a small amount of extra overhead on insertion and a larger amount of overhead on key removal, but absolutely no additional key lookup overhead. This class is conceptually similar to (though less feature-rich than) the java.util.LinkedHashMap class added in JDK 1.4.

    See Also:
    keysInInsertionOrder(), getKeysInInsertionOrder(java.util.List<? super K>), Serialized Form
    • Constructor Detail

      • OrderedHashMap

        public OrderedHashMap()
        Deprecated. 
        Construct a new empty map with a default capacity and load factor.
      • OrderedHashMap

        public OrderedHashMap(int initialCapacity)
        Deprecated. 
        Construct a new empty map with the specified initial capacity and a default load factor.
        Parameters:
        initialCapacity - the initial capacity
      • OrderedHashMap

        public OrderedHashMap(int initialCapacity,              float loadFactor)
        Deprecated. 
        Constructs a new, empty map with the specified initial capacity and the specified load factor.
        Parameters:
        initialCapacity - the initial capacity
        loadFactor - the load factor
      • OrderedHashMap

        public OrderedHashMap(Map<? extends K,? extends V> map)
        Deprecated. 
        Constructs a new map with the same mappings as the given map. The initial capacity and load factor is the same as for the parent HashMap class. Since there's no way of knowing in what order entries were made in the original map, the order imposed on them in this map is the order in which they are returned by the keySet() method.
        Parameters:
        map - the map whose mappings are to be copied
        See Also:
        OrderedHashMap(OrderedHashMap)
      • OrderedHashMap

        public OrderedHashMap(OrderedHashMap<? extends K,? extends V> map)
        Deprecated. 
        Constructs a new map with the same mappings as the given OrderedHashMap. The initial capacity and load factor is the same as for the parent HashMap class. The insertion order of the keys is preserved.
        Parameters:
        map - the map whose mappings are to be copied
    • Method Detail

      • getKeysInInsertionOrder

        public int getKeysInInsertionOrder(List<? super K> list)
        Deprecated. 
        Get the keys in the order they were added to this map.
        Parameters:
        list - the List to receive the keys
        Returns:
        the number of keys added to the list
        See Also:
        keysInInsertionOrder()
      • clone

        public Object clone()
        Deprecated. 
        Returns a shallow copy of this instance. The keys and values themselves are not cloned.
        Overrides:
        clone in class HashMap<K,V>
        Returns:
        a shallow copy of this map
      • clear

        public void clear()
        Deprecated. 
        Remove all mappings from this map.
        Specified by:
        clear in interface Map<K,V>
        Overrides:
        clear in class HashMap<K,V>
      • put

        public V put(K key,    V value)
        Deprecated. 
        Associates the specified value with the specified key in this map. If the key already has a value in this map, the existing value is replaced by the new value, and the old value is replaced. If the key already exists in the map, it is moved to the end of the key insertion order list.
        Specified by:
        put in interface Map<K,V>
        Overrides:
        put in class HashMap<K,V>
        Parameters:
        key - the key with which the specified value is to be associated
        value - the value to associate with the specified key
        Returns:
        the previous value associated with the key, or null if (a) there was no previous value, or (b) the previous value was a null
      • putAll

        public void putAll(Map<? extends K,? extends V> map)
        Deprecated. 
        Copies all of the mappings from a specified map to this one. These mappings replace any mappings that this map had for any of the keys in this map. Since there's no way of knowing in what order entries were made in the original map, they are appended to the key insertion order list in the order they are returned by the map's keySet() method.
        Specified by:
        putAll in interface Map<K,V>
        Overrides:
        putAll in class HashMap<K,V>
        Parameters:
        map - the map whose mappings are to be copied
        See Also:
        putAll(OrderedHashMap)
      • putAll

        public void putAll(OrderedHashMap<? extends K,? extends V> map)
        Deprecated. 
        Copies all of the mappings from a specified map to this one. These mappings replace any mappings that this map had for any of the keys in this map. The keys are appended to this map's key insertion order list in the order they were originally added to map.
        Parameters:
        map - the map whose mappings are to be copied
        See Also:
        putAll(OrderedHashMap), keysInInsertionOrder()
      • remove

        public V remove(Object key)
        Deprecated. 
        Removes the mapping for a key, if there is one. The key is also removed from the key insertion order list.
        Specified by:
        remove in interface Map<K,V>
        Overrides:
        remove in class HashMap<K,V>
        Parameters:
        key - the key to remove
        Returns:
        the previous value associated with the key, or null if (a) there was no previous value, or (b) the previous value was a null

SCaVis 2.2 © jWork.ORG