We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
.values()
Map
It makes the code smarter. Note: This is difficult to notice, wouldn't make sense to subtract for this.
No response
complexity
return switch (string) { case "A" -> MyEnum.A, case "B" -> MyEnum.B, case "C" -> MyEnum.C, case "D" -> MyEnum.D, default -> throw new IllegalArgumentException("invalid input string: " + string); };
Could be written as:
for (var value : MyEnum.values()) { if (string.equals(value.toString())) { return value; } } throw new IllegalArgumentException("invalid input string: " + string);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What it does
It makes the code smarter. Note: This is difficult to notice, wouldn't make sense to subtract for this.
Lint Name
No response
Category
complexity
Example
Could be written as:
The text was updated successfully, but these errors were encountered: