-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
proposal: net/url: add (Values).AddAll(key string, values []string) #33498
Comments
|
Could you perhaps elaborate how much this would improve a real-world application? |
This is Add:
It's only a convenience function; it would be fine to write the append. It is also fine to write @OneOfOne's version when you have multiple values. The complexity analysis in the top comment is not accurate. Assuming AddAll uses @OneOfOne's append, the loops are identical in runtime - both are O(N), because append is amortized O(1). |
I just found two cases of this in golang/go
|
Marked this last week as likely decline w/ call for last comments (#33498 (comment)). |
The current (Values).Add, you know, enables us to add one value to one key, but is less convenient sometimes, especially when you want to add multiple values to one key (etc: coping one Values to another Values).
If (Values).AddAll is available, you can write like the blow.
It may make code clearer and improve it. (The code seems to be O(N).)
Is it good idea to (Values).AddAll to add multiple values to one key at the same time?
The text was updated successfully, but these errors were encountered: