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

add a Map.put(key: A, value: B): Option[B] #26

Open
performantdata opened this issue Sep 8, 2015 · 3 comments
Open

add a Map.put(key: A, value: B): Option[B] #26

performantdata opened this issue Sep 8, 2015 · 3 comments

Comments

@performantdata
Copy link

In analogy with mutable.Map. Otherwise one has to search twice, with

val old = m.get(k)
m.update(k, v)
old

which, admittedly, is what MapLike does but isn't efficient.

I can PR such, if you want.

@non
Copy link
Owner

non commented Sep 8, 2015

@performantdata Sounds good. Another one that I think would be nice to have would be some variant of getOrElseUpdate.

@performantdata
Copy link
Author

So you want that I write it?

@non
Copy link
Owner

non commented Sep 8, 2015

Feel free to write it if you want. Otherwise, I'll get to it eventually (but maybe not super soon).

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

2 participants