From 6a5b40c09716d33d67038823ccbe1039346088ac Mon Sep 17 00:00:00 2001 From: "M.V. Hutz" Date: Mon, 13 Apr 2026 20:49:33 -0400 Subject: [PATCH] docs: replaced instances of "bucket" with "table" - Removed instances of `growthFactor`, as it is unexported. - Typo in `HashTable.String()`. --- hash_table.go | 8 ++++---- settings.go | 2 +- table.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hash_table.go b/hash_table.go index 25bb155..fde9d3e 100644 --- a/hash_table.go +++ b/hash_table.go @@ -45,7 +45,7 @@ func (t *HashTable[K, V]) load() float64 { return float64(t.Size()) / float64(t.TotalCapacity()) } -// resize clears all buckets, changes the sizes of them to a specific capacity, +// resize clears all tables, changes the sizes of them to a specific capacity, // and fills them back up again. It is a helper function for [HashTable.grow] and // [HashTable.shrink]; use them instead. func (t *HashTable[K, V]) resize(capacity uint64) error { @@ -66,7 +66,7 @@ func (t *HashTable[K, V]) resize(capacity uint64) error { return nil } -// grow increases the table's capacity by the [HashTable.growthFactor]. If the +// grow increases the table's capacity by the growth factor. If the // capacity is 0, it increases it to 1. func (t *HashTable[K, V]) grow() error { var newCapacity uint64 @@ -80,7 +80,7 @@ func (t *HashTable[K, V]) grow() error { return t.resize(newCapacity) } -// shrink reduces the table's capacity by the [HashTable.growthFactor]. It may +// shrink reduces the table's capacity by the growth factor. It may // reduce it down to 0. func (t *HashTable[K, V]) shrink() error { return t.resize(t.tableA.capacity / t.growthFactor) @@ -173,7 +173,7 @@ func (t *HashTable[K, V]) Entries() iter.Seq2[K, V] { } // String returns the entries of the table as a string in the format: -// "table[k1:v1 h2:v2 ...]". +// "table[k1:v1 k2:v2 ...]". func (t *HashTable[K, V]) String() string { var sb strings.Builder sb.WriteString("table[") diff --git a/settings.go b/settings.go index 7af5dbf..28cad7a 100644 --- a/settings.go +++ b/settings.go @@ -29,7 +29,7 @@ type settings struct { // like [New], for example. type Option func(*settings) -// Capacity modifies the starting capacity of each bucket of the [HashTable]. The +// Capacity modifies the starting capacity of each table of the [HashTable]. The // value must be non-negative. func Capacity(value int) Option { if value < 0 { diff --git a/table.go b/table.go index c676a5d..b3247e0 100644 --- a/table.go +++ b/table.go @@ -17,7 +17,7 @@ type table[K, V any] struct { compare EqualFunc[K] } -// location determines where in the bucket a certain key would be placed. If the +// location determines where in the table a certain key would be placed. If the // capacity is 0, this will panic. func (t table[K, V]) location(key K) uint64 { return t.hash(key) % t.capacity