This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git
The following commit(s) were added to refs/heads/master by this push:
new 293384d Use Math.max().
293384d is described below
commit 293384d82b805d46aef17afd275f3b5d7821b29b
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Jun 26 15:06:20 2020 -0400
Use Math.max().
---
src/main/java/org/apache/commons/text/TextStringBuilder.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java
b/src/main/java/org/apache/commons/text/TextStringBuilder.java
index 7370d8a..7798c9b 100644
--- a/src/main/java/org/apache/commons/text/TextStringBuilder.java
+++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java
@@ -2572,7 +2572,7 @@ public class TextStringBuilder implements CharSequence,
Appendable, Serializable
* @return The first index of the character, or -1 if not found
*/
public int indexOf(final char ch, int startIndex) {
- startIndex = startIndex < 0 ? 0 : startIndex;
+ startIndex = Math.max(0, startIndex);
if (startIndex >= size) {
return -1;
}
@@ -2612,7 +2612,7 @@ public class TextStringBuilder implements CharSequence,
Appendable, Serializable
* @return The first index of the string, or -1 if not found
*/
public int indexOf(final String str, int startIndex) {
- startIndex = startIndex < 0 ? 0 : startIndex;
+ startIndex = Math.max(0, startIndex);
if (str == null || startIndex >= size) {
return -1;
}
@@ -2668,7 +2668,7 @@ public class TextStringBuilder implements CharSequence,
Appendable, Serializable
* @return The first index matched, or -1 if not found
*/
public int indexOf(final StringMatcher matcher, int startIndex) {
- startIndex = startIndex < 0 ? 0 : startIndex;
+ startIndex = Math.max(0, startIndex);
if (matcher == null || startIndex >= size) {
return -1;
}