|
||||||||||
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>
net.sourceforge.jaulp.collections.InsertionOrderMap<K,V>
public class InsertionOrderMap<K,V>
This class overwrites the put-method from the LinkedHashMap. That inserts the value to the right order it was inserted in the Map. Note that the difference in the LinkedHashMap is the order does not change if we put the same key with a new value. In this class the order changes when we put a new value with the same key.
LinkedHashMap
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Constructor Summary | |
---|---|
InsertionOrderMap()
Constructs an empty insertion-ordered InsertionOrderMap instance with a default capacity (16) and load factor (0.75). |
|
InsertionOrderMap(int initialCapacity)
Constructs an empty insertion-ordered InsertionOrderMap instance with the specified initial capacity and a default load factor (0.75). |
|
InsertionOrderMap(int initialCapacity,
float loadFactor)
Constructs an empty insertion-ordered InsertionOrderMap instance with the specified initial capacity and load factor. |
|
InsertionOrderMap(int initialCapacity,
float loadFactor,
boolean accessOrder)
Constructs an empty InsertionOrderMap instance with the specified initial capacity, load factor and ordering mode. |
|
InsertionOrderMap(java.util.Map<? extends K,? extends V> m)
Constructs an insertion-ordered InsertionOrderMap instance with the same mappings as the specified map. |
Method Summary | |
---|---|
V |
put(K key,
V value)
Associates the specified value with the specified key in this map. |
Methods inherited from class java.util.LinkedHashMap |
---|
clear, containsValue, get, removeEldestEntry |
Methods inherited from class java.util.HashMap |
---|
clone, containsKey, entrySet, isEmpty, keySet, putAll, remove, size, values |
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 |
---|
containsKey, entrySet, equals, hashCode, isEmpty, keySet, putAll, remove, size, values |
Constructor Detail |
---|
public InsertionOrderMap()
public InsertionOrderMap(int initialCapacity)
initialCapacity
- the initial capacity.
java.lang.IllegalArgumentException
- if the initial capacity is negative.public InsertionOrderMap(int initialCapacity, float loadFactor)
initialCapacity
- the initial capacity.loadFactor
- the load factor.
java.lang.IllegalArgumentException
- if the initial capacity is negative or the load factor is
nonpositive.public InsertionOrderMap(int initialCapacity, float loadFactor, boolean accessOrder)
initialCapacity
- the initial capacity.loadFactor
- the load factor.accessOrder
- the ordering mode - true for access-order,
false for insertion-order.
java.lang.IllegalArgumentException
- if the initial capacity is negative or the load factor is
nonpositive.public InsertionOrderMap(java.util.Map<? extends K,? extends V> m)
m
- the map whose mappings are to be placed in this map.
java.lang.NullPointerException
- if the specified map is null.Method Detail |
---|
public V put(K key, V value)
put
in interface java.util.Map<K,V>
put
in class java.util.HashMap<K,V>
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |