diff --git a/sync.go b/sync.go index 470d0b0..1cf6e64 100644 --- a/sync.go +++ b/sync.go @@ -57,6 +57,15 @@ func (this *ConcurrentMap[T1, T2]) Range(f func(key T1, value T2) bool) { }) } +func (this *ConcurrentMap[T1, T2]) GetSize() int { + var size int + this.kvHash.Range(func (key, value interface{}) bool { + size += 1 + return true + }) + return size +} + func (this *ConcurrentMap[T1, T2]) Store(key T1, value T2) { this.kvHash.Store(key, value) }