diff --git a/internal/xsync/map.go b/internal/xsync/map.go index c4ddf1597..61f135dd1 100644 --- a/internal/xsync/map.go +++ b/internal/xsync/map.go @@ -58,7 +58,7 @@ func (m *Map[K, V]) Delete(key K) bool { return exists } -func (m *Map[K, V]) Size() int { +func (m *Map[K, V]) Len() int { return int(m.size.Load()) } diff --git a/internal/xsync/map_test.go b/internal/xsync/map_test.go index fadec2725..02f63e97a 100644 --- a/internal/xsync/map_test.go +++ b/internal/xsync/map_test.go @@ -42,7 +42,7 @@ func TestMap(t *testing.T) { 2: "two", 3: "three", } - require.Equal(t, 2, m.Size()) + require.Equal(t, 2, m.Len()) var unexp map[int]string m.Range(func(key int, value string) bool { if v, ok := exp[key]; ok && v == value { @@ -56,7 +56,7 @@ func TestMap(t *testing.T) { require.Empty(t, exp) require.Empty(t, unexp) m.Clear() - require.Zero(t, m.Size()) + require.Zero(t, m.Len()) empty := true m.Range(func(key int, value string) bool { empty = false