API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util. LinkedHashMap View Source
Author(s)
Josh Bloch
Since
1.4
Version
1.26, 04/21/06
Serial
Hierarchy
 Object
      AbstractMap
          HashMap
              LinkedHashMap
Implements
 Map
Subclasses
Description
public class LinkedHashMap
  Hash table and linked list implementation of the Map interface, with predictable iteration order.
Constructors
public LinkedHashMap ()
Constructs an empty insertion-ordered LinkedHashMap instance with the default initial capacity (16) and load factor (0.75).
public LinkedHashMap (int initialCapacity)
  Constructs an empty insertion-ordered LinkedHashMap instance with the specified initial capacity and a default load factor (0.75).
public LinkedHashMap (int initialCapacity, float loadFactor)
  Constructs an empty insertion-ordered LinkedHashMap instance with the specified initial capacity and load factor.
public LinkedHashMap (int initialCapacity, float loadFactor, boolean accessOrder)
  Constructs an empty LinkedHashMap instance with the specified initial capacity, load factor and ordering mode.
public LinkedHashMap (Map<Object, Object> m)
  Constructs an insertion-ordered LinkedHashMap instance with the same mappings as the specified map.
Methods
Hide/Show inherited methods
pack-private void addEntry (int hash, K key, V value, int bucketIndex) [Overrides HashMap]
  This override alters behavior of superclass put method.
pack-private int capacity () [Inherited From HashMap]
public void clear () [Overrides HashMap] [Specified in Map]
  Removes all of the mappings from this map.
public Object clone () [Inherited From HashMap]
  Returns a shallow copy of this HashMap instance: the keys and values themselves are not cloned.
public boolean containsKey (Object key) [Inherited From HashMap]
  Returns true if this map contains a mapping for the specified key.
public boolean containsValue (Object value) [Overrides HashMap] [Specified in Map]
  Returns true if this map maps one or more keys to the specified value.
pack-private void createEntry (int hash, K key, V value, int bucketIndex) [Overrides HashMap]
This override differs from addEntry in that it doesn't resize the table or remove the eldest entry.
public Set<Entry< K, V>> entrySet () [Inherited From HashMap] [Specified in AbstractMap]
  Returns a Set view of the mappings contained in this map.
public boolean equals (Object o) [Inherited From AbstractMap]
  Compares the specified object with this map for equality.
public V get (Object key) [Overrides HashMap] [Specified in Map]
  Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
pack-privatefinal Entry< K, V> getEntry (Object key) [Inherited From HashMap]
  Returns the entry associated with the specified key in the HashMap.
pack-privatestatic int hash (int h) [Inherited From HashMap]
  Applies a supplemental hash function to a given hashCode, which defends against poor quality hash functions.
public int hashCode () [Inherited From AbstractMap]
  Returns the hash code value for this map.
pack-privatestatic int indexFor (int h, int length) [Inherited From HashMap]
Returns index for hash code h.
pack-private void init () [Overrides HashMap]
  Called by superclass constructors and pseudoconstructors (clone, readObject) before any entries are inserted into the map.
public boolean isEmpty () [Inherited From HashMap]
  Returns true if this map contains no key-value mappings.
public Set< K> keySet () [Inherited From HashMap]
  Returns a Set view of the keys contained in this map.
pack-private float loadFactor () [Inherited From HashMap]
pack-private Iterator<Entry< K, V>> newEntryIterator () [Overrides HashMap]
pack-private Iterator< K> newKeyIterator () [Overrides HashMap]
pack-private Iterator< V> newValueIterator () [Overrides HashMap]
public V put ( K key, V value) [Inherited From HashMap]
  Associates the specified value with the specified key in this map.
public void putAll (Map<Object, Object> m) [Inherited From HashMap]
  Copies all of the mappings from the specified map to this map.
public V remove (Object key) [Inherited From HashMap]
  Removes the mapping for the specified key from this map if present.
protected boolean removeEldestEntry (Entry< K, V> eldest)
  Returns true if this map should remove its eldest entry.
pack-privatefinal Entry< K, V> removeEntryForKey (Object key) [Inherited From HashMap]
  Removes and returns the entry associated with the specified key in the HashMap.
pack-privatefinal Entry< K, V> removeMapping (Object o) [Inherited From HashMap]
Special version of remove for EntrySet.
pack-private void resize (int newCapacity) [Inherited From HashMap]
  Rehashes the contents of this map into a new array with a larger capacity.
public int size () [Inherited From HashMap]
  Returns the number of key-value mappings in this map.
public String toString () [Inherited From AbstractMap]
  Returns a string representation of this map.
pack-private void transfer (Entry newTable) [Overrides HashMap]
  Transfers all entries to new table array.
public Collection< V> values () [Inherited From HashMap]
  Returns a Collection view of the values contained in this map.
Fields
Hide/Show inherited fields
pack-privatefinalstatic int DEFAULT_INITIAL_CAPACITY = "16" [Inherited From HashMap]
The default initial capacity - MUST be a power of two.
pack-privatefinalstatic float DEFAULT_LOAD_FACTOR = "0.75" [Inherited From HashMap]
The load factor used when none specified in constructor.
pack-privatetransientvolatile Set< K> keySet [Inherited From AbstractMap]
  Each of these fields are initialized to contain an instance of the appropriate view the first time this view is requested.
pack-privatefinal float loadFactor [Inherited From HashMap]
The load factor for the hash table.
pack-privatefinalstatic int MAXIMUM_CAPACITY = "1073741824" [Inherited From HashMap]
  The maximum capacity, used if a higher value is implicitly specified by either of the constructors with arguments.
pack-privatetransientvolatile int modCount [Inherited From HashMap]
  The number of times this HashMap has been structurally modified Structural modifications are those that change the number of mappings in the HashMap or otherwise modify its internal structure (e.g., rehash).
pack-privatetransient int size [Inherited From HashMap]
The number of key-value mappings contained in this map.
pack-privatetransient Entry table [Inherited From HashMap]
  The table, resized as necessary.
pack-private int threshold [Inherited From HashMap]
The next size value at which to resize (capacity * load factor).
pack-privatetransientvolatile Collection< V> values [Inherited From AbstractMap]
Nested Classes
  HashMap.Entry
  AbstractMap.SimpleEntry
An Entry maintaining a key and a value.
  AbstractMap.SimpleImmutableEntry
An Entry maintaining an immutable key and value.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar