Skip to content

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

Merged
DenizAltunkapan merged 6 commits intoTheAlgorithms:masterfrom
Papichardog:patch-average-docs
Apr 11, 2026
Merged

feat(maths): enhance Average with stream method and improved JavaDoc#7369
DenizAltunkapan merged 6 commits intoTheAlgorithms:masterfrom
Papichardog:patch-average-docs

Conversation

@Papichardog
Copy link
Copy Markdown
Contributor

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.50%. Comparing base (e0a7223) to head (765d5d2).

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.52%   79.50%   -0.02%     
  Complexity     7143     7143              
============================================
  Files           796      796              
  Lines         23365    23368       +3     
  Branches       4596     4596              
============================================
- Hits          18581    18579       -2     
- Misses         4047     4050       +3     
- Partials        737      739       +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
@DenizAltunkapan DenizAltunkapan enabled auto-merge (squash) April 11, 2026 11:01
@DenizAltunkapan DenizAltunkapan merged commit 1edf319 into TheAlgorithms:master Apr 11, 2026
7 checks passed
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