Package org.antlr.v4.runtime.misc
Class FlexibleHashMap<K,V>
java.lang.Object
org.antlr.v4.runtime.misc.FlexibleHashMap<K,V>
- All Implemented Interfaces:
Map<K,
V>
- Direct Known Subclasses:
PredictionMode.AltAndContextMap
A limited map (many unsupported operations) that lets me use
varying hashCode/equals.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LinkedList<FlexibleHashMap.Entry<K,
V>>[] protected final AbstractEqualityComparator
<? super K> protected int
static final int
static final int
protected final int
protected final int
static final double
protected int
How many elements in setprotected int
when to expand -
Constructor Summary
ConstructorsConstructorDescriptionFlexibleHashMap
(AbstractEqualityComparator<? super K> comparator) FlexibleHashMap
(AbstractEqualityComparator<? super K> comparator, int initialCapacity, int initialBucketCapacity) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) private static <K,
V> LinkedList<FlexibleHashMap.Entry<K, V>>[] createEntryListArray
(int length) entrySet()
boolean
protected void
expand()
protected int
int
hashCode()
boolean
isEmpty()
keySet()
static void
void
int
size()
toString()
values()
Methods inherited from class java.lang.Object
clone, 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
-
INITAL_CAPACITY
public static final int INITAL_CAPACITY- See Also:
-
INITAL_BUCKET_CAPACITY
public static final int INITAL_BUCKET_CAPACITY- See Also:
-
LOAD_FACTOR
public static final double LOAD_FACTOR- See Also:
-
comparator
-
buckets
-
n
protected int nHow many elements in set -
currentPrime
protected int currentPrime -
threshold
protected int thresholdwhen to expand -
initialCapacity
protected final int initialCapacity -
initialBucketCapacity
protected final int initialBucketCapacity
-
-
Constructor Details
-
FlexibleHashMap
public FlexibleHashMap() -
FlexibleHashMap
-
FlexibleHashMap
public FlexibleHashMap(AbstractEqualityComparator<? super K> comparator, int initialCapacity, int initialBucketCapacity)
-
-
Method Details
-
createEntryListArray
-
getBucket
-
get
-
put
-
remove
-
putAll
-
keySet
-
values
-
entrySet
-
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V>
-
hashCode
public int hashCode() -
equals
-
expand
protected void expand() -
size
public int size() -
isEmpty
public boolean isEmpty() -
clear
public void clear() -
toString
-
toTableString
-
main
-