|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
public class LinkedHashMap<K,V>
LinkedHashMap is a variant on HashMap. Its entries are kept in a doubly-linked list. The iteration order is, by default, the order in which keys were inserted.
If the three argument constructor is used, and order is specified as true,
the iteration would be in the order that entries were accessed. The access order gets
affected by put(), get(), putAll() operations, but not by operations on the collection views.
Null elements are allowed, and all the optional Map operations are supported.
| Nested Class Summary | |
|---|---|
(package private) static class |
LinkedHashMap.LinkedHashIterator<E,KT,VT>
|
(package private) static class |
LinkedHashMap.LinkedHashMapEntry<K,V>
|
(package private) static class |
LinkedHashMap.LinkedHashMapEntrySet<KT,VT>
|
| Nested classes/interfaces inherited from class java.util.HashMap |
|---|
HashMap.Entry<K,V>, HashMap.HashMapEntrySet<KT,VT>, HashMap.HashMapIterator<E,KT,VT> |
| Field Summary |
|---|
| Fields inherited from class java.util.HashMap |
|---|
elementCount, elementData, loadFactor, modCount, threshold |
| Fields inherited from class java.util.AbstractMap |
|---|
keySet, valuesCollection |
| Constructor Summary | |
|---|---|
LinkedHashMap()
Constructs a new empty instance of LinkedHashMap. |
|
LinkedHashMap(int s)
Constructor with specified size. |
|
LinkedHashMap(int s,
float lf)
Constructor with specified size and load factor. |
|
LinkedHashMap(int s,
float lf,
boolean order)
Constructor with specified size, load factor and access order |
|
LinkedHashMap(Map<? extends K,? extends V> m)
Constructor with input map |
|
| Method Summary | |
|---|---|
void |
clear()
Removes all mappings from this HashMap, leaving it empty. |
(package private) HashMap.Entry<K,V> |
createEntry(K key,
int index,
V value)
|
(package private) HashMap.Entry<K,V> |
createHashedEntry(K key,
int index,
int hash)
|
Set<Map.Entry<K,V>> |
entrySet()
Returns a Set of the mappings contained in this HashMap. |
V |
get(Object key)
Retrieve the map value corresponding to the given key. |
Set<K> |
keySet()
Returns a Set of the keys contained in this HashMap. |
(package private) void |
linkEntry(LinkedHashMap.LinkedHashMapEntry<K,V> m)
|
(package private) HashMap.Entry<K,V>[] |
newElementArray(int s)
Create a new element array |
V |
put(K key,
V value)
Set the mapped value for the given key to the given value. |
(package private) V |
putImpl(K key,
V value)
|
V |
remove(Object key)
Remove the entry corresponding to the given key. |
protected boolean |
removeEldestEntry(Map.Entry<K,V> eldest)
This method is queried from the put and putAll methods to check if the eldest member of the map should be deleted before adding the new member. |
Collection<V> |
values()
Returns a Collection of the values contained in this HashMap. |
| Methods inherited from class java.util.HashMap |
|---|
clone, containsKey, containsValue, findNonNullKeyEntry, findNullKeyEntry, isEmpty, putAll, rehash, rehash, removeEntry, size |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public LinkedHashMap()
public LinkedHashMap(int s)
s - Size of LinkedHashMap required
public LinkedHashMap(int s,
float lf)
s - Size of LinkedHashMap requiredlf - Load factor
public LinkedHashMap(int s,
float lf,
boolean order)
s - Size of LinkedHashmap requiredlf - Load factororder - If true indicates that traversal order should begin with most
recently accessedpublic LinkedHashMap(Map<? extends K,? extends V> m)
m - Input map| Method Detail |
|---|
HashMap.Entry<K,V>[] newElementArray(int s)
newElementArray in class HashMap<K,V>s -
public V get(Object key)
get in interface Map<K,V>get in class HashMap<K,V>key - Key value
HashMap.Entry<K,V> createEntry(K key,
int index,
V value)
createEntry in class HashMap<K,V>
HashMap.Entry<K,V> createHashedEntry(K key,
int index,
int hash)
createHashedEntry in class HashMap<K,V>
public V put(K key,
V value)
put in interface Map<K,V>put in class HashMap<K,V>key - Key valuevalue - New mapped value
V putImpl(K key,
V value)
putImpl in class HashMap<K,V>void linkEntry(LinkedHashMap.LinkedHashMapEntry<K,V> m)
public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>entrySet in class HashMap<K,V>public Set<K> keySet()
keySet in interface Map<K,V>keySet in class HashMap<K,V>public Collection<V> values()
values in interface Map<K,V>values in class HashMap<K,V>public V remove(Object key)
remove in interface Map<K,V>remove in class HashMap<K,V>key - the key
protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
eldest -
public void clear()
clear in interface Map<K,V>clear in class HashMap<K,V>HashMap.isEmpty(),
HashMap.size()
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||