Skip to content

Conversation

@bayramtturgutt
Copy link
Contributor

  • 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.
  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

- 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-commenter
Copy link

codecov-commenter commented Aug 3, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 41.53%. Comparing base (fccd141) to head (5581299).

Files Patch % Lines
src/main/java/com/thealgorithms/maths/Average.java 50.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link
Member

@BamaCharanChhandogi BamaCharanChhandogi left a 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
return(double)..
Copy link
Member

@BamaCharanChhandogi BamaCharanChhandogi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.

@BamaCharanChhandogi BamaCharanChhandogi merged commit 6f52114 into TheAlgorithms:master Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants