Package gnu.kawa.util
Class GeneralHashTable<K,V>
- All Implemented Interfaces:
Map<K,
V>
- Direct Known Subclasses:
IdentityHashTable
,LitTable
,NamedCharTable
,NameLookup
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,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields inherited from class gnu.kawa.util.AbstractHashTable
DEFAULT_INITIAL_SIZE, mask, num_bindings, table
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallocEntries
(int n) Allocate Entry[n].protected int
getEntryHashCode
(HashNode<K, V> entry) Extract hash-code from Entry.getEntryNext
(HashNode<K, V> entry) Extract next Entry in same hash-bucket.This override helps Kawa type-inference - for example in srfi69.scm.Allocate a new node in the hash table.protected void
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
-
Constructor Details
-
GeneralHashTable
public GeneralHashTable() -
GeneralHashTable
public GeneralHashTable(int capacity)
-
-
Method Details
-
getEntryHashCode
Description copied from class:AbstractHashTable
Extract hash-code from Entry.- Specified by:
getEntryHashCode
in classAbstractHashTable<HashNode<K,
V>, K, V>
-
getEntryNext
Description copied from class:AbstractHashTable
Extract next Entry in same hash-bucket.- Specified by:
getEntryNext
in classAbstractHashTable<HashNode<K,
V>, K, V>
-
setEntryNext
Description copied from class:AbstractHashTable
Set next Entry in same hash-bucket.- Specified by:
setEntryNext
in classAbstractHashTable<HashNode<K,
V>, K, V>
-
allocEntries
Description copied from class:AbstractHashTable
Allocate Entry[n].- Specified by:
allocEntries
in classAbstractHashTable<HashNode<K,
V>, K, V>
-
makeEntry
Allocate a new node in the hash table. -
getNode
This override helps Kawa type-inference - for example in srfi69.scm.
-