Commit 0ad5d90
* fix: prevent NPE when array contains null elements
When searching for a non-null key in an array that contains null elements,
the sentinel linear search would throw a NullPointerException because it
called array[i].compareTo(key) without checking if array[i] is null.
Added null check for array[i] in the while loop condition to prevent NPE
and return the correct index when array elements themselves are null.
Issue: #7318 (related)
* fix: remove malformed @author javadoc in AnyBaseToAnyBase (issue #7393)
* fix: remove malformed javadoc in ReverseString (part of issue #7393)
---------
Co-authored-by: OpenClaw Agent <agent@openclaw.ai>
Co-authored-by: OpenClaw Bot <fix-bug@openclaw.ai>
Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
1 parent b3e31b5 commit 0ad5d90
3 files changed
Lines changed: 4 additions & 3 deletions
File tree
- src/main/java/com/thealgorithms
- conversions
- searches
- strings
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
0 commit comments