wk8 / go-ordered-map

Optimal implementation of ordered maps for Golang - ie maps that remember the order in which keys were inserted.
Apache License 2.0
523 stars 40 forks source link

feat: add support for iterators introduced in go1.23 #41

Closed TristanSpeakEasy closed 2 months ago

TristanSpeakEasy commented 2 months ago

This PR adds support for the new iter package in go1.23 allowing a for range loop to be used with the ordered maps improving devex

TristanSpeakEasy commented 2 months ago

Thanks @wk8 I chose to match the naming of the map.All, map.Keys and map.Values function in the stdlib as it would help with discovery but let me know if you would like me to definitely changes these to the suggested names.

I can also update the readme

TristanSpeakEasy commented 2 months ago

Ideally we'd want iterators from newest pairs too?

Actually in light of this I changes all the names and added the new methods

TristanSpeakEasy commented 2 months ago

okay have address the feedback plus added a utility From method for making copies easily using the iterators

TristanSpeakEasy commented 2 months ago

@wk8 anything else you would like changed? Otherwise can we have this merged please would be great to get a few of our dependencies updated

chase-crumbaugh commented 2 months ago

I've been wanting this feature for a while now. Thanks for putting the PR together. Happy to help as needed to get this merged

amir20 commented 1 month ago

Just realized this hasn't been released yet. 🫠 Any plans to release?