diff --git a/pkg/treemap/custom.go b/pkg/treemap/custom.go index 147c049d..7ca03e76 100644 --- a/pkg/treemap/custom.go +++ b/pkg/treemap/custom.go @@ -49,14 +49,14 @@ func (m *TreeMap[K, V]) LowerBound(key K) *TreeMapIterator[K, V] { return &TreeMapIterator[K, V]{iter} } -// FoorOrMin finds the floor key-value pair for the input key. +// FloorOrMin finds the floor key-value pair for the input key. // If no floor is found, returns the key-value pair for the least key. // In case that map is empty, then both returned values will be corresponding type's empty value. // // Floor key is defined as the greatest key that is less than or equal to the given key. // A floor key may not be found, either because the map is empty, or because // all keys in the map are greater than the given key. -func (m *TreeMap[K, V]) FoorOrMin(key K) (foundKey K, foundValue V, ok bool) { +func (m *TreeMap[K, V]) FloorOrMin(key K) (foundKey K, foundValue V, ok bool) { node, found := m.tree.Floor(key) if found { return node.Key, node.Value, true diff --git a/pkg/treemap/treemap_test.go b/pkg/treemap/treemap_test.go index c03cfe3c..d81fee53 100644 --- a/pkg/treemap/treemap_test.go +++ b/pkg/treemap/treemap_test.go @@ -306,7 +306,7 @@ func TestMapLowerBound(t *testing.T) { } } -func TestMapFoorOrMin(t *testing.T) { +func TestMapFloorOrMin(t *testing.T) { m := New[int, string]() m.Put(1, "a") m.Put(3, "c") @@ -326,7 +326,7 @@ func TestMapFoorOrMin(t *testing.T) { for _, test := range tests1 { // retrievals - actualKey, actualValue, ok := m.FoorOrMin(test.boundKey) + actualKey, actualValue, ok := m.FloorOrMin(test.boundKey) if actualKey != test.Key || actualValue != test.Value || ok != test.Exist { t.Errorf("Got %v, %v, %v, expected %v, %v, %v", actualKey, actualValue, ok, test.Key, test.Value, test.Exist) }