Skip to content

Commit f93fc72

Browse files
Improve documentation and readability in LinearSearch
1 parent 79bc620 commit f93fc72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/thealgorithms/searches/LinearSearch.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ public class LinearSearch implements SearchAlgorithm {
4141
*
4242
* @param array List to be searched
4343
* @param value Key being searched for
44-
* @return Location of the key, -1 if array is null or empty, or key not found
44+
* @return Index of the key if found; otherwise -1 if the array is null, empty, or the key is not found
4545
*/
4646
@Override
4747
public <T extends Comparable<T>> int find(T[] array, T value) {
4848

49-
if (array == null || array.length == 0 || value == null) {
49+
if (array == null || array.length == 0) {
5050
return -1;
5151
}
5252

0 commit comments

Comments
 (0)