K
- The type of keys maintained by this ArrayMapV
- The type of mapped valuespublic class ArrayMap<K,V>
extends java.lang.Object
implements java.util.Map<K,V>
An ArrayMap is a Map implemented as a resizable array, just like that of an ArrayList. An ArrayMap takes up less memory than other Map types, and offers at-least-comparable performance to a HashMap when the Map size is very small. For best results, the initial capacity of an ArrayMap should be set to the smallest number that the ArrayMap's size will almost certainly never exceed.
ArrayList
Constructor and Description |
---|
ArrayMap()
Constructs an empty ArrayMap with an initial capacity of 10.
|
ArrayMap(int initialCapacity)
Constructs an empty ArrayMap with the specified initial capacity.
|
ArrayMap(java.util.Map<? extends K,? extends V> m)
Constructs an ArrayMap with the same mappings as the specified Map.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
void |
ensureCapacity(int minCapacity)
Increases the capacity of this ArrayMap, if necessary, to be at least the
specified minimum capacity.
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
V |
get(java.lang.Object key) |
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> m) |
V |
remove(java.lang.Object key) |
int |
size() |
void |
trimToSize()
Trims the capacity of this ArrayMap to be equal to its current size.
|
java.util.Collection<V> |
values() |
public ArrayMap(int initialCapacity)
initialCapacity
- The initial capacity of the ArrayMappublic ArrayMap()
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public final void trimToSize()
public final void ensureCapacity(int minCapacity)
minCapacity
- The minimum capacity that this ArrayMap should have