func (m *Dictionary[KT, VT]) Each(fn func(KT, VT) bool) {
	m.lock.RLock()
	if m.m == nil {
		m.lock.RUnlock()
		return
	}
	m2 := make(map[KT]VT)
	for k, v := range m.m {
		m2[k] = v
	}
	m.lock.RUnlock()
	for k, v := range m2 {
		if !fn(k, v) {
			return
		}
	}
}
// Each calls the given function for each key=value pair in the map.
// It creates a copy of the map to iterate, so setting a key inside
// the loop will not affect the iteration.
Each calls the given function for each key=value pair in the map.
It creates a copy of the map to iterate, so setting a key inside
the loop will not affect the iteration.
// Each calls the given function for each key = value pair in the map . // It creates a copy of the map to iterate so setting a key inside // the loop will not affect the iteration .
func (m *Dictionary[KT, VT]) Each(fn func(KT, VT) bool) {
	m.lock.RLock()
	if m.m == nil {
		m.lock.RUnlock()
		return
	}
	m2 := make(map[KT]VT)
	for k, v := range m.m {
		m2[k] = v
	}
	m.lock.RUnlock()
	for k, v := range m2 {
		if !fn(k, v) {
			return
		}
	}
}
func ( m * Dictionary [ KT , VT ] ) Each ( fn func ( KT , VT ) bool ) { m . lock . RLock ( ) if m . m == nil { m . lock . RUnlock ( ) return } m2 := make ( map [ KT ] VT ) for k , v := range m . m { m2 [ k ] = v } m . lock . RUnlock ( ) for k , v := range m2 { if ! fn ( k , v ) { return } } }
Each calls the given function for each key=value pair in the map.
Each calls the given function for each key = value pair in the map .