docs: replaced instances of "bucket" with "table"

- Removed instances of `growthFactor`, as it is unexported.
- Typo in `HashTable.String()`.
This commit is contained in:
2026-04-13 20:49:33 -04:00
parent 395a3560c7
commit 6a5b40c097
3 changed files with 6 additions and 6 deletions

View File

@@ -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[")