Package pascal.taie.util.collection
Class ArrayMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
pascal.taie.util.collection.ArrayMap<K,V>
- All Implemented Interfaces:
Serializable
,Map<K,
V>
Map implementation based on ArrayList. This class should only be
used for small set. Keys cannot be null.
Note that remove(Object) will shift the elements after the removed one.
TODO: if necessary, optimize remove(Object) and let add(Object) add
element to empty hole of the array.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
-
Constructor Summary
-
Method Summary
Methods inherited from class java.util.AbstractMap
clear, clone, equals, hashCode, keySet, putAll, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITY- See Also:
-
-
Constructor Details
-
ArrayMap
public ArrayMap() -
ArrayMap
public ArrayMap(int initialCapacity) -
ArrayMap
public ArrayMap(int initialCapacity, boolean fixedCapacity)
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V> - Overrides:
containsValue
in classAbstractMap<K,
V>
-
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractMap<K,
V>
-
get
-
put
-
remove
-
entrySet
-