func (m *SortedDictionary[KT, VT]) Each(fn func(KT, VT) bool) {
	m.lock.RLock()
	if len(m.items) < 1 {
		m.lock.RUnlock()
		return
	}
	m2 := make([]sortedDictionaryItem[KT, VT], len(m.items))
	copy(m2, m.items)
	m.lock.RUnlock()
	for _, v := range m2 {
		if !fn(v.key, v.val) {
			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 *SortedDictionary[KT, VT]) Each(fn func(KT, VT) bool) {
	m.lock.RLock()
	if len(m.items) < 1 {
		m.lock.RUnlock()
		return
	}
	m2 := make([]sortedDictionaryItem[KT, VT], len(m.items))
	copy(m2, m.items)
	m.lock.RUnlock()
	for _, v := range m2 {
		if !fn(v.key, v.val) {
			return
		}
	}
}
func ( m * SortedDictionary [ KT , VT ] ) Each ( fn func ( KT , VT ) bool ) { m . lock . RLock ( ) if len ( m . items ) < 1 { m . lock . RUnlock ( ) return } m2 := make ( [ ] sortedDictionaryItem [ KT , VT ] , len ( m . items ) ) copy ( m2 , m . items ) m . lock . RUnlock ( ) for _ , v := range m2 { if ! fn ( v . key , v . val ) { 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 .