Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] SortedMap pop and shift methods #245

Open
anatol-grabowski opened this issue Oct 31, 2021 · 0 comments
Open

[feature request] SortedMap pop and shift methods #245

anatol-grabowski opened this issue Oct 31, 2021 · 0 comments

Comments

@anatol-grabowski
Copy link

This functionality was lacking when I was implementing order book service (https://docs.kraken.com/websockets/#message-book) through SortedMap. When the maximum stored length is reached and a new level comes we want to pop the last element.

This could of course be implemented through map.delete(map.entries()[0][0]) but a call to entries would run a loop over each item in the map which is ineffective.

Currently I've implemented pop through map.store.pop(); map.length = map.store.length which uses the internals but does the job. Maybe there already is a cleaner way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant