mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 08:32:40 +08:00
iter
This commit is contained in:
@ -49,6 +49,17 @@ func (m *ConcurrnetMap[K, V]) Exist(key K) bool {
|
||||
return mm.Exist(key)
|
||||
}
|
||||
|
||||
func (m *ConcurrnetMap[K, V]) Iter() <-chan *Entry[K, V] {
|
||||
num := int(m.numOfBuckets)
|
||||
ch := make(chan *Entry[K, V], m.Count())
|
||||
for i := 0; i < num; i++ {
|
||||
c := m.buckets[i].Iter()
|
||||
ch <- <-c
|
||||
}
|
||||
|
||||
return ch
|
||||
}
|
||||
|
||||
func (m *ConcurrnetMap[K, V]) ForEach(f func(K, V)) {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
|
Reference in New Issue
Block a user