-
Notifications
You must be signed in to change notification settings - Fork 153
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 Java 8 Map shortcut methods #26
Comments
+1. |
I moved putIfAbsent to KTypeVTypeMap. The signature is slightly different than in java Maps though - it returns a boolean (indicating whether they key existed or not). This keeps it consistent with a method that existed in both map implementations (otherwise the API would break). Adding other utility methods would mean we need all variants of predicates/ functions, etc. And once you allow closure arguments... well, it stops being a high-performance thing... ;) I do find those methods useful too so maybe we should change/ break the API in the future and just depart from the old model. I'll leave this issue open. |
Thanks!
Well, that's not true. In a lot of cases, those trivial closures are inlined in modern Java: And that's, by the way, one of the things that could improve |
I know how lambdas are implemented. They really require a good few reiterations in c2 to be efficient though. Anyway, it's not the point. I agree it could be done, but there's never enough time unless you have a pressing need. If you do - please provide a patch, we'll gladly consider. |
hi! Just checking if there has been any work on this front before thinking about a contribution. Please share if there has. |
Well, it is open. There is a still-holding relevant comment above though:
|
putIfAbsent
computeIfAbsent
computeIfPresent
The text was updated successfully, but these errors were encountered: