Skip to content

feat(maths): enhance Average with stream method and improved JavaDoc#7369

Open
Papichardog wants to merge 5 commits intoTheAlgorithms:masterfrom
Papichardog:patch-average-docs
Open

feat(maths): enhance Average with stream method and improved JavaDoc#7369
Papichardog wants to merge 5 commits intoTheAlgorithms:masterfrom
Papichardog:patch-average-docs

Conversation

@Papichardog
Copy link
Copy Markdown

Description

Enhanced the Average.java utility class in the com.thealgorithms.maths package with two improvements:

  • Improved JavaDoc comments on existing methods, clarifying truncation behavior on average(int[]) and adding @throws documentation.
  • Added a new averageStream(double[]) method using the Java Stream API as a modern, declarative alternative. Returns OptionalDouble following Stream API conventions.

Checklist

  • 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 algorithms include a corresponding test class that validates their functionality.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.51%. Comparing base (49f9e1a) to head (a93fca0).

Files with missing lines Patch % Lines
src/main/java/com/thealgorithms/maths/Average.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7369      +/-   ##
============================================
- Coverage     79.51%   79.51%   -0.01%     
- Complexity     7142     7144       +2     
============================================
  Files           796      796              
  Lines         23359    23362       +3     
  Branches       4596     4596              
============================================
+ Hits          18575    18577       +2     
- Misses         4046     4049       +3     
+ Partials        738      736       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Papichardog Papichardog marked this pull request as ready for review April 10, 2026 06:25
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.

2 participants