K - the generic type of keys maintained by this mapV - the generic type of mapped valuespublic class InsertionOrderMap<K,V> extends LinkedHashMap<K,V>
InsertionOrderMap 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 FormAbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
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(Map<? extends K,? extends V> m)
Constructs an insertion-ordered
InsertionOrderMap instance with the same mappings as
the specified map. |
| Modifier and Type | Method and Description |
|---|---|
V |
put(K key,
V value)
Associates the specified value with the specified key in this map.
|
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, sizeequals, hashCode, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, sizepublic InsertionOrderMap()
InsertionOrderMap instance with a default
capacity (16) and load factor (0.75).public InsertionOrderMap(int initialCapacity)
InsertionOrderMap instance with the specified
initial capacity and a default load factor (0.75).initialCapacity - the initial capacity.IllegalArgumentException - if the initial capacity is negative.public InsertionOrderMap(int initialCapacity,
float loadFactor)
InsertionOrderMap instance with the specified
initial capacity and load factor.initialCapacity - the initial capacity.loadFactor - the load factor.IllegalArgumentException - if the initial capacity is negative or the load factor is nonpositive.public InsertionOrderMap(int initialCapacity,
float loadFactor,
boolean accessOrder)
InsertionOrderMap instance with the specified initial capacity,
load factor and ordering mode.initialCapacity - the initial capacity.loadFactor - the load factor.accessOrder - the ordering mode - true for access-order, false for
insertion-order.IllegalArgumentException - if the initial capacity is negative or the load factor is nonpositive.public InsertionOrderMap(Map<? extends K,? extends V> m)
InsertionOrderMap instance with the same mappings as
the specified map. The InsertionOrderMap instance is created with a a default load
factor (0.75) and an initial capacity sufficient to hold the mappings in the specified map.m - the map whose mappings are to be placed in this map.NullPointerException - if the specified map is null.public V put(K key, V value)
put in interface Map<K,V>put in class HashMap<K,V>key - key with which the specified value is to be associated.value - value to be associated with the specified key.Copyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.