This commit is contained in:
aozhiwei 2024-07-23 15:38:58 +08:00
parent ccfa6c4f99
commit ad5656a00a

View File

@ -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) { func (this *ConcurrentMap[T1, T2]) Store(key T1, value T2) {
this.kvHash.Store(key, value) this.kvHash.Store(key, value)
} }