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

On Varargs #82

Closed
BrentonPoke opened this issue Jul 16, 2019 · 4 comments
Closed

On Varargs #82

BrentonPoke opened this issue Jul 16, 2019 · 4 comments
Labels

Comments

@BrentonPoke
Copy link

This is mainly a stylistic question, but instead of varargs values, wouldn't most just make a set? I can't imagine a scenario where you would want duplicate values for a tag, and a set could force uniqueness.

public QueryTagMetric addTag(String name, String... values)
	{
		checkNotNullOrEmpty(name, "name cannot be null or empty");
		checkArgument(values.length > 0, "value must be greater than 0");

		for (String value : values)
		{
			checkNotNullOrEmpty(value, "value cannot be null or empty");
		}

		tags.putAll(name, Arrays.asList(values));

		return (this);
	}
@jsabin
Copy link
Contributor

jsabin commented Jul 21, 2019

You are correct. The code should be fixed to ensure tags are unique.

@BrentonPoke
Copy link
Author

@jsabin What do you think about my PR?

@BrentonPoke
Copy link
Author

Was this ever going to get merged?

@brianhks
Copy link
Member

Yeah just merged it. Didn't realize how long this was sitting round.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants