Package gnu.kawa.util
Class WeakIdentityHashMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- gnu.kawa.util.AbstractHashTable<WeakHashNode<K,V>,K,V>
-
- gnu.kawa.util.WeakIdentityHashMap<K,V>
-
- All Implemented Interfaces:
Map<K,V>
public class WeakIdentityHashMap<K,V> extends AbstractHashTable<WeakHashNode<K,V>,K,V>
-
-
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>
-
-
Field Summary
-
Fields inherited from class gnu.kawa.util.AbstractHashTable
DEFAULT_INITIAL_SIZE, mask, num_bindings, table
-
-
Constructor Summary
Constructors Constructor Description WeakIdentityHashMap()
WeakIdentityHashMap(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected WeakHashNode<K,V>[]
allocEntries(int n)
Allocate Entry[n].V
get(Object key, V defaultValue)
Find value for given key.protected int
getEntryHashCode(WeakHashNode<K,V> entry)
Extract hash-code from Entry.protected WeakHashNode<K,V>
getEntryNext(WeakHashNode<K,V> entry)
Extract next Entry in same hash-bucket.int
hash(Object key)
Calculate hash code of a key.protected WeakHashNode<K,V>
makeEntry(K key, int hash, V value)
Allocate a new node in the hash table.protected boolean
matches(K key1, Object key2)
Compare two keys for equivalence.V
put(K key, int hash, V value)
V
remove(Object key)
protected void
setEntryNext(WeakHashNode<K,V> entry, WeakHashNode<K,V> next)
Set next Entry in same hash-bucket.-
Methods inherited from class gnu.kawa.util.AbstractHashTable
clear, entrySet, get, getNode, getOrDefault, hashToIndex, matches, put, rehash, size
-
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, 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, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Method Detail
-
getEntryHashCode
protected int getEntryHashCode(WeakHashNode<K,V> entry)
Description copied from class:AbstractHashTable
Extract hash-code from Entry.- Specified by:
getEntryHashCode
in classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
getEntryNext
protected WeakHashNode<K,V> getEntryNext(WeakHashNode<K,V> entry)
Description copied from class:AbstractHashTable
Extract next Entry in same hash-bucket.- Specified by:
getEntryNext
in classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
setEntryNext
protected void setEntryNext(WeakHashNode<K,V> entry, WeakHashNode<K,V> next)
Description copied from class:AbstractHashTable
Set next Entry in same hash-bucket.- Specified by:
setEntryNext
in classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
allocEntries
protected WeakHashNode<K,V>[] allocEntries(int n)
Description copied from class:AbstractHashTable
Allocate Entry[n].- Specified by:
allocEntries
in classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
hash
public int hash(Object key)
Description copied from class:AbstractHashTable
Calculate hash code of a key.- Overrides:
hash
in classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
matches
protected boolean matches(K key1, Object key2)
Description copied from class:AbstractHashTable
Compare two keys for equivalence. Override this and theAbstractHashTable.hash(Object)
method if you want a different equivalence relation.- Overrides:
matches
in classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
makeEntry
protected WeakHashNode<K,V> makeEntry(K key, int hash, V value)
Description copied from class:AbstractHashTable
Allocate a new node in the hash table.- Specified by:
makeEntry
in classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
get
public V get(Object key, V defaultValue)
Description copied from class:AbstractHashTable
Find value for given key. Return defaultValue if not found.- Overrides:
get
in classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
put
public V put(K key, int hash, V value)
- Overrides:
put
in classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
-