alphadose / haxmap

Fastest and most memory efficient golang concurrent hashmap
MIT License
915 stars 45 forks source link

Iterate(ForEach) has no way to break #10

Closed godcong closed 2 years ago

godcong commented 2 years ago

In the case of a lot of data, I need to stop this iteration after I get a piece of data. But there is no way to top in the current iteration.

        syncmaps.Range(func(key, value any) bool {

            if ok {

                return false
            }
            return true
        })

Like in sync.Map I can return false to stop the iteration

alphadose commented 2 years ago

@godcong this feature has been added with https://github.com/alphadose/haxmap/commit/f4af9b50631e3c27e0f1aa5ae8faf8c09f9fc564

will publish a new release soon with some more fixes