Skip to content

Enhance LinearSearch with null check for value#7355

Merged
DenizAltunkapan merged 2 commits intoTheAlgorithms:masterfrom
AbhiramSakha:patch-8
Apr 4, 2026
Merged

Enhance LinearSearch with null check for value#7355
DenizAltunkapan merged 2 commits intoTheAlgorithms:masterfrom
AbhiramSakha:patch-8

Conversation

@AbhiramSakha
Copy link
Copy Markdown
Contributor

Fixes #7348

Changes made:

  • Added null check for input array
  • Handled empty array case
  • Added null check for search value
  • Prevented NullPointerException by checking array elements

Result:

Improved robustness and stability of LinearSearch implementation

Added null check for the search value in the find method.
@DenizAltunkapan DenizAltunkapan enabled auto-merge (squash) April 4, 2026 21:40
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.43%. Comparing base (f38d5cd) to head (5af4613).

Files with missing lines Patch % Lines
.../java/com/thealgorithms/searches/LinearSearch.java 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7355      +/-   ##
============================================
- Coverage     79.44%   79.43%   -0.01%     
- Complexity     7114     7115       +1     
============================================
  Files           793      793              
  Lines         23273    23273              
  Branches       4583     4583              
============================================
- Hits          18489    18487       -2     
- Misses         4046     4047       +1     
- Partials        738      739       +1     

☔ 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.

@DenizAltunkapan DenizAltunkapan merged commit b7e9c85 into TheAlgorithms:master Apr 4, 2026
7 checks passed
@AbhiramSakha AbhiramSakha deleted the patch-8 branch April 5, 2026 02:06
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.

Handle null and empty input in LinearSearch implementation

3 participants