From f93fc72049a09d74a7f3d306dfcf473da42b59e9 Mon Sep 17 00:00:00 2001 From: Madhavi Solanki Date: Tue, 14 Apr 2026 02:06:15 +0530 Subject: [PATCH] Improve documentation and readability in LinearSearch --- src/main/java/com/thealgorithms/searches/LinearSearch.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/thealgorithms/searches/LinearSearch.java b/src/main/java/com/thealgorithms/searches/LinearSearch.java index 3f273e167f0a..a76f1cace3ef 100644 --- a/src/main/java/com/thealgorithms/searches/LinearSearch.java +++ b/src/main/java/com/thealgorithms/searches/LinearSearch.java @@ -41,12 +41,12 @@ public class LinearSearch implements SearchAlgorithm { * * @param array List to be searched * @param value Key being searched for - * @return Location of the key, -1 if array is null or empty, or key not found + * @return Index of the key if found; otherwise -1 if the array is null, empty, or the key is not found */ @Override public > int find(T[] array, T value) { - if (array == null || array.length == 0 || value == null) { + if (array == null || array.length == 0) { return -1; }