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 intstatic final intstatic final intprotected final intprotected final intstatic final doubleprotected intHow many elements in setprotected intwhen to expand -
Constructor Summary
ConstructorsConstructorDescriptionFlexibleHashMap(AbstractEqualityComparator<? super K> comparator) FlexibleHashMap(AbstractEqualityComparator<? super K> comparator, int initialCapacity, int initialBucketCapacity) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) private static <K,V> LinkedList<FlexibleHashMap.Entry<K, V>>[] createEntryListArray(int length) entrySet()booleanprotected voidexpand()protected intinthashCode()booleanisEmpty()keySet()static voidvoidintsize()toString()values()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein 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
-