Package org.antlr.v4.runtime.misc
Class FlexibleHashMap<K,V>
- java.lang.Object
-
- org.antlr.v4.runtime.misc.FlexibleHashMap<K,V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFlexibleHashMap.Entry<K,V>
-
Field Summary
Fields Modifier and Type Field Description protected LinkedList<FlexibleHashMap.Entry<K,V>>[]bucketsprotected AbstractEqualityComparator<? super K>comparatorprotected intcurrentPrimestatic intINITAL_BUCKET_CAPACITYstatic intINITAL_CAPACITYprotected intinitialBucketCapacityprotected intinitialCapacitystatic doubleLOAD_FACTORprotected intnHow many elements in setprotected intthresholdwhen to expand
-
Constructor Summary
Constructors Constructor Description FlexibleHashMap()FlexibleHashMap(AbstractEqualityComparator<? super K> comparator)FlexibleHashMap(AbstractEqualityComparator<? super K> comparator, int initialCapacity, int initialBucketCapacity)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<K,V>>entrySet()booleanequals(Object o)protected voidexpand()Vget(Object key)protected intgetBucket(K key)inthashCode()booleanisEmpty()Set<K>keySet()static voidmain(String[] args)Vput(K key, V value)voidputAll(Map<? extends K,? extends V> m)Vremove(Object key)intsize()StringtoString()StringtoTableString()Collection<V>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 Detail
-
INITAL_CAPACITY
public static final int INITAL_CAPACITY
- See Also:
- Constant Field Values
-
INITAL_BUCKET_CAPACITY
public static final int INITAL_BUCKET_CAPACITY
- See Also:
- Constant Field Values
-
LOAD_FACTOR
public static final double LOAD_FACTOR
- See Also:
- Constant Field Values
-
comparator
protected final AbstractEqualityComparator<? super K> comparator
-
buckets
protected LinkedList<FlexibleHashMap.Entry<K,V>>[] buckets
-
n
protected int n
How many elements in set
-
currentPrime
protected int currentPrime
-
threshold
protected int threshold
when to expand
-
initialCapacity
protected final int initialCapacity
-
initialBucketCapacity
protected final int initialBucketCapacity
-
-
Constructor Detail
-
FlexibleHashMap
public FlexibleHashMap()
-
FlexibleHashMap
public FlexibleHashMap(AbstractEqualityComparator<? super K> comparator)
-
FlexibleHashMap
public FlexibleHashMap(AbstractEqualityComparator<? super K> comparator, int initialCapacity, int initialBucketCapacity)
-
-
Method Detail
-
getBucket
protected int getBucket(K key)
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<K,V>
-
hashCode
public int hashCode()
-
equals
public boolean equals(Object o)
-
expand
protected void expand()
-
toTableString
public String toTableString()
-
main
public static void main(String[] args)
-
-