By candid | Posted :
Dec 11, 2015
| Updated :
Dec 11, 2015
Class LinkedHashMap
Type Parameters: K - the type of keys maintained by this map V - the type of mapped values All Implemented Interfaces: Serializable, Cloneable, Map
public class LinkedHashMap extends HashMap implements Map { //
}
Since: 1.4
See Also: Object.hashCode(), Collection, Map, HashMap, TreeMap, Hashtable, Serialized Form
Nested classes/interfaces inherited from class java.util.AbstractMap AbstractMap.SimpleEntry, AbstractMap.SimpleImmutableEntry
Constructors summary
LinkedHashMap() Constructs an empty insertion-ordered LinkedHashMap instance with the default initial capacity (16) and load factor (0.75).
LinkedHashMap(int initialCapacity) Constructs an empty insertion-ordered LinkedHashMap instance with the specified initial capacity and a default load factor (0.75).
LinkedHashMap(int initialCapacity, float loadFactor) Constructs an empty insertion-ordered LinkedHashMap instance with the specified initial capacity and load factor.
LinkedHashMap(int initialCapacity, float loadFactor, boolean accessOrder) Constructs an empty LinkedHashMap instance with the specified initial capacity, load factor and ordering mode.
LinkedHashMap(Map m) Constructs an insertion-ordered LinkedHashMap instance with the same mappings as the specified map.
Methodssummary
void clear() Removes all of the mappings from this map.
public Set> entrySet() Returns a Set view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
public Set keySet() Returns a Set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
public V put(K key,V value) Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced.
public void putAll(Map m) Copies all of the mappings from the specified map to this map. These mappings will replace any mappings that this map had for any of the keys currently in the specified map.
public int size() Returns the number of key-value mappings in this map.
public Collection values() Returns a Collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Collection.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
Methods inherited from class java.lang.Object finalize, getClass, notify, notifyAll, wait, wait, wait,clone,equals, hashCode, toString