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].Vget(Object key, V defaultValue)Find value for given key.protected intgetEntryHashCode(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.inthash(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 booleanmatches(K key1, Object key2)Compare two keys for equivalence.Vput(K key, int hash, V value)Vremove(Object key)protected voidsetEntryNext(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:AbstractHashTableExtract hash-code from Entry.- Specified by:
getEntryHashCodein classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
getEntryNext
protected WeakHashNode<K,V> getEntryNext(WeakHashNode<K,V> entry)
Description copied from class:AbstractHashTableExtract next Entry in same hash-bucket.- Specified by:
getEntryNextin classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
setEntryNext
protected void setEntryNext(WeakHashNode<K,V> entry, WeakHashNode<K,V> next)
Description copied from class:AbstractHashTableSet next Entry in same hash-bucket.- Specified by:
setEntryNextin classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
allocEntries
protected WeakHashNode<K,V>[] allocEntries(int n)
Description copied from class:AbstractHashTableAllocate Entry[n].- Specified by:
allocEntriesin classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
hash
public int hash(Object key)
Description copied from class:AbstractHashTableCalculate hash code of a key.- Overrides:
hashin classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
matches
protected boolean matches(K key1, Object key2)
Description copied from class:AbstractHashTableCompare two keys for equivalence. Override this and theAbstractHashTable.hash(Object)method if you want a different equivalence relation.- Overrides:
matchesin classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
makeEntry
protected WeakHashNode<K,V> makeEntry(K key, int hash, V value)
Description copied from class:AbstractHashTableAllocate a new node in the hash table.- Specified by:
makeEntryin classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
get
public V get(Object key, V defaultValue)
Description copied from class:AbstractHashTableFind value for given key. Return defaultValue if not found.- Overrides:
getin classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
put
public V put(K key, int hash, V value)
- Overrides:
putin classAbstractHashTable<WeakHashNode<K,V>,K,V>
-
-