Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
(f func(Key, Value) bool)
| 218 | // Range calls f sequentially for each key and value present in the map. |
| 219 | // If f returns false, range stops the iteration. |
| 220 | func (m *Map[Key, Value]) Range(f func(Key, Value) bool) { |
| 221 | item := m.linkedList.First() |
| 222 | |
| 223 | for item != nil { |
| 224 | value := item.Value() |
| 225 | if !f(item.key, value) { |
| 226 | return |
| 227 | } |
| 228 | item = item.Next() |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | func (m *Map[Key, Value]) allocate(newSize uintptr) { |
| 233 | m.linkedList = NewList[Key, Value]() |