Package org.antlr.v4.runtime.misc
Class FlexibleHashMap<K,V>
- java.lang.Object
-
- org.antlr.v4.runtime.misc.FlexibleHashMap<K,V>
-
- All Implemented Interfaces:
java.util.Map<K,V>
public class FlexibleHashMap<K,V> extends java.lang.Object implements java.util.Map<K,V>
A limited map (many unsupported operations) that lets me use varying hashCode/equals.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FlexibleHashMap.Entry<K,V>
-
Field Summary
Fields Modifier and Type Field Description protected java.util.LinkedList<FlexibleHashMap.Entry<K,V>>[]
buckets
protected AbstractEqualityComparator<? super K>
comparator
protected int
currentPrime
static int
INITAL_BUCKET_CAPACITY
static int
INITAL_CAPACITY
protected int
initialBucketCapacity
static double
LOAD_FACTOR
protected int
n
How many elements in setprotected int
threshold
-
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 void
clear()
boolean
containsKey(java.lang.Object key)
boolean
containsValue(java.lang.Object value)
java.util.Set<java.util.Map.Entry<K,V>>
entrySet()
boolean
equals(java.lang.Object o)
protected void
expand()
V
get(java.lang.Object key)
protected int
getBucket(K key)
int
hashCode()
boolean
isEmpty()
java.util.Set<K>
keySet()
static void
main(java.lang.String[] args)
V
put(K key, V value)
void
putAll(java.util.Map<? extends K,? extends V> m)
V
remove(java.lang.Object key)
int
size()
java.lang.String
toString()
java.lang.String
toTableString()
java.util.Collection<V>
values()
-
-
-
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 java.util.LinkedList<FlexibleHashMap.Entry<K,V>>[] buckets
-
n
protected int n
How many elements in set
-
threshold
protected int threshold
-
currentPrime
protected int currentPrime
-
initialBucketCapacity
protected 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)
-
values
public java.util.Collection<V> values()
-
containsKey
public boolean containsKey(java.lang.Object key)
-
containsValue
public boolean containsValue(java.lang.Object value)
-
hashCode
public int hashCode()
-
equals
public boolean equals(java.lang.Object o)
-
expand
protected void expand()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toTableString
public java.lang.String toTableString()
-
main
public static void main(java.lang.String[] args)
-
-