Package gnu.kawa.util
Class GeneralHashTable<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- gnu.kawa.util.AbstractHashTable<HashNode<K,V>,K,V>
-
- gnu.kawa.util.GeneralHashTable<K,V>
-
- All Implemented Interfaces:
Map<K,V>
- Direct Known Subclasses:
IdentityHashTable
,LitTable
,NamedCharTable
,NameLookup
public class GeneralHashTable<K,V> extends AbstractHashTable<HashNode<K,V>,K,V>
A generic hash table. Supports deletions, and re-allocates the table when too big. The equivalence relation can be customized.
-
-
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 GeneralHashTable()
GeneralHashTable(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected HashNode<K,V>[]
allocEntries(int n)
Allocate Entry[n].protected int
getEntryHashCode(HashNode<K,V> entry)
Extract hash-code from Entry.protected HashNode<K,V>
getEntryNext(HashNode<K,V> entry)
Extract next Entry in same hash-bucket.HashNode<K,V>
getNode(Object key)
This override helps Kawa type-inference - for example in srfi69.scm.protected HashNode<K,V>
makeEntry(K key, int hash, V value)
Allocate a new node in the hash table.protected void
setEntryNext(HashNode<K,V> entry, HashNode<K,V> next)
Set next Entry in same hash-bucket.-
Methods inherited from class gnu.kawa.util.AbstractHashTable
clear, entrySet, get, get, getOrDefault, hash, hashToIndex, matches, matches, put, put, rehash, remove, 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(HashNode<K,V> entry)
Description copied from class:AbstractHashTable
Extract hash-code from Entry.- Specified by:
getEntryHashCode
in classAbstractHashTable<HashNode<K,V>,K,V>
-
getEntryNext
protected HashNode<K,V> getEntryNext(HashNode<K,V> entry)
Description copied from class:AbstractHashTable
Extract next Entry in same hash-bucket.- Specified by:
getEntryNext
in classAbstractHashTable<HashNode<K,V>,K,V>
-
setEntryNext
protected void setEntryNext(HashNode<K,V> entry, HashNode<K,V> next)
Description copied from class:AbstractHashTable
Set next Entry in same hash-bucket.- Specified by:
setEntryNext
in classAbstractHashTable<HashNode<K,V>,K,V>
-
allocEntries
protected HashNode<K,V>[] allocEntries(int n)
Description copied from class:AbstractHashTable
Allocate Entry[n].- Specified by:
allocEntries
in classAbstractHashTable<HashNode<K,V>,K,V>
-
makeEntry
protected HashNode<K,V> makeEntry(K key, int hash, V value)
Allocate a new node in the hash table.
-
-