mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 08:32:40 +08:00
map
This commit is contained in:
@ -87,10 +87,12 @@ func (m *sorted_map[K, V]) Iter() <-chan *Entry[K, V] {
|
||||
return c
|
||||
}
|
||||
|
||||
func (m *sorted_map[K, V]) ForEach(f func(K, V)) {
|
||||
func (m *sorted_map[K, V]) ForEach(f func(K, V) bool) {
|
||||
for _, k := range m.keys {
|
||||
if v, ok := m.Get(k); ok {
|
||||
f(k, v)
|
||||
if f(k, v) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user