-
Notifications
You must be signed in to change notification settings - Fork 19.9k
Update Average.java #5309
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
Update Average.java #5309
Conversation
- Made the constructor throw an UnsupportedOperationException to prevent instantiation, making it explicit that this is a utility class. - Added a private validateInput method to handle validation, reducing code duplication and improving readability. - Consistent exception messages and handling for both methods. - Improved comments to be more descriptive and follow JavaDoc conventions. - Enhanced code readability and maintained consistent formatting.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5309 +/- ##
============================================
- Coverage 41.53% 41.53% -0.01%
- Complexity 2556 2557 +1
============================================
Files 520 520
Lines 15424 15426 +2
Branches 2947 2947
============================================
Hits 6407 6407
- Misses 8723 8725 +2
Partials 294 294 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have mentioned that you have to change it. lastly, this line has to be changed.
return (double)
sum / numbers.length;
1. throw new IllegalArgumentException("Numbers array cannot be empty or null"); 2. int --> double
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks.
clang-format -i --style=file path/to/your/file.java