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

Override LongMap updateWith, add transformValue and transformValueDefault #130

Open
Adam-Vandervorst opened this issue Sep 27, 2022 · 1 comment

Comments

@Adam-Vandervorst
Copy link

LongMap's is a performance oriented addition, yet updating it requires two lookups because the updateWith function is delegated to MapOps.

Furthermore, updateWith deals with the 'XT' Option[A] => Option[A] remap function, which discourages otherwise good uses of the function, and degrades performance. Therefore I propose to add transformValue(key: K)(transformation: V => V) and transformValueDefault(key: K)(default: => V)(transformation: V => V) that deal with the most common usecases.

@julienrf
Copy link
Contributor

I think it’s possible to override updateWith already in Scala 2.13. Would you be interested in submitting a PR?

About the other suggestions, yes they would have to go into scala-library-next.

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