-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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 putEntry Method to Multimap #5886
Comments
The idea isn't unreasonable. We already have If we did add a method, I think it would be called |
If boolean remove(key, value);
boolean containsEntry(key, value); where similar concept could be applied. Of course with method's overloading and default methods it doesn't bloat the interface too much. Simply the question is how many things you would like to have there. If you decide one way or another then I can provide you a PR with the change 👍 |
I like the idea of addressing these cases consistently (while I'm not expressing an opinion on doing them all or none). The |
HI @Adrodoc is anyone working on this issue , or i can add your proposal solution into respective interface |
I am not aware of anyone working on this. |
Hi @Adrodoc, |
@bhavrana Yes, there does not seem to be anyone working on it and this is still relevant. I would love to see this added. |
hi @Adrodoc |
hi @bhavrana, |
The comments above from myself and @eamonnmcmanus are from Guava team members, and although they are vaguely non-negative, the fact still remains that Guava is not really in a "growth mode" right now, and it is not clear whether we would decide to add this method. Writing any code would be premature. And sadly, even the activity of deciding whether to add it or not is not a high priority for us right now. For the most part, we think Guava is okay as it is. Please read over https://github.com/google/guava/wiki/HowToContribute#code-contributions carefully; it explains some of this, and better ways to help the project, which would be appreciated if we're lucky enough to get them. |
Problem
When you have a method returning an entry there is currently no good way to insert this entry into a
Multimap
without using a local variable. This is quite annoying when you have multiple calls returning multiple entries.Consider the following code example:
As you can see the four workarounds are all quite verbose, which can make the code hard to understand, when there is a bit more going on than just a simple call to
roleDice()
.Proposal
It would be cool to have a default method
putEntry
on the Multimap interface to allow writing the last version in the above example:The text was updated successfully, but these errors were encountered: