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

Order-respecting Map? #15

Open
ovatsus opened this issue Apr 27, 2014 · 3 comments
Open

Order-respecting Map? #15

ovatsus opened this issue Apr 27, 2014 · 3 comments

Comments

@ovatsus
Copy link

ovatsus commented Apr 27, 2014

Time and time again I face the issue of having to replace a Map with a list of pairs, because I need the original order to be preserved.
Would be nice to have a collection like that, even if it's just having both Map and a list of keys under the hood

@mausch
Copy link
Member

mausch commented Apr 27, 2014

@ovatsus
Copy link
Author

ovatsus commented Apr 27, 2014

That's what I usually do, but that way you loose the performance of the lookups

@panesofglass panesofglass changed the title Order-respecing Map? Order-respecting Map? Jun 4, 2014
@kspeakman
Copy link

I find myself needing this too. I trivial implementation would be to wrap a PersistentVector (or a basic List that you just know is in reverse order) together with a Map. Using the first for key ordering and the second for value lookup. But it would be nice not to double up on memory usage for keys.

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

3 participants