Package pascal.taie.util.collection
Class IndexMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
pascal.taie.util.collection.IndexMap<K,V>
- Type Parameters:
K
- the type of keys maintained by this mapV
- the type of mapped values
- All Implemented Interfaces:
Serializable
,Map<K,
V>
Array-based implementation of the
Map
interface.
This implementation requires a Indexer
, which provides
a unique index for each key object that could be put into this map.
Since the indexer maintains the mappings between objects and indexes,
this map does not need to store the keys, and it only keeps an array
(values
) of the corresponding values.
A key object would be indexed to index
by the indexer.
If values[index]
is null
, it means that the corresponding
key is absent in this map. Hence, it does not permit null
values.
This implementation is designed for maps whose size is close to the universe.
- 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> -
Constructor Summary
-
Method Summary
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, 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
-
Constructor Details
-
IndexMap
-
-
Method Details
-
capacity
public int capacity() -
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractMap<K,
V>
-
get
-
put
-
remove
-
clear
public void clear() -
entrySet
-
keySet
-