public class OrderedMap<K,V> extends ObjectMap<K,V>
ObjectMap
that also stores keys in an Array
using the insertion order. There is some additional overhead for
put and remove. Iteration over the entries()
, keys()
, and values()
is ordered and faster than an
unordered map. Keys can also be accessed and the order changed using orderedKeys()
.限定符和类型 | 类和说明 |
---|---|
static class |
OrderedMap.OrderedMapEntries<K,V> |
static class |
OrderedMap.OrderedMapKeys<K> |
static class |
OrderedMap.OrderedMapValues<V> |
ObjectMap.Entries<K,V>, ObjectMap.Entry<K,V>, ObjectMap.Keys<K>, ObjectMap.Values<V>
构造器和说明 |
---|
OrderedMap() |
OrderedMap(int initialCapacity) |
OrderedMap(int initialCapacity,
float loadFactor) |
OrderedMap(OrderedMap<? extends K,? extends V> map) |
限定符和类型 | 方法和说明 |
---|---|
void |
clear() |
void |
clear(int maximumCapacity)
Clears the map and reduces the size of the backing arrays to be the specified capacity if they are larger.
|
ObjectMap.Entries<K,V> |
entries()
Returns an iterator for the entries in the map.
|
ObjectMap.Entries<K,V> |
iterator() |
ObjectMap.Keys<K> |
keys()
Returns an iterator for the keys in the map.
|
Array<K> |
orderedKeys() |
V |
put(K key,
V value)
Returns the old value associated with the specified key, or null.
|
V |
remove(K key) |
java.lang.String |
toString() |
ObjectMap.Values<V> |
values()
Returns an iterator for the values in the map.
|
containsKey, containsValue, ensureCapacity, equals, findKey, get, get, hashCode, putAll, shrink, toString
public OrderedMap()
public OrderedMap(int initialCapacity)
public OrderedMap(int initialCapacity, float loadFactor)
public OrderedMap(OrderedMap<? extends K,? extends V> map)
public V put(K key, V value)
ObjectMap
public void clear(int maximumCapacity)
ObjectMap
public ObjectMap.Entries<K,V> iterator()
public ObjectMap.Entries<K,V> entries()
OrderedMap.OrderedMapEntries
constructor for nested or multithreaded iteration.public ObjectMap.Values<V> values()
OrderedMap.OrderedMapValues
constructor for nested or multithreaded iteration.public ObjectMap.Keys<K> keys()
OrderedMap.OrderedMapKeys
constructor for nested or multithreaded iteration.