aherbert commented on code in PR #699:
URL: https://github.com/apache/commons-text/pull/699#discussion_r2311944378
##########
src/main/java/org/apache/commons/text/TextStringBuilder.java:
##########
@@ -3208,17 +3208,29 @@ public TextStringBuilder trim() {
}
/**
- * Validates that an index is in the range {@code 0 <= index <= size}.
+ * Validates that an index is in the range {@code 0 <= index < size}.
*
* @param index the index to test.
- * @throws IndexOutOfBoundsException Thrown when the index is not the
range {@code 0 <= index <= size}.
+ * @throws IndexOutOfBoundsException Thrown when the index is not the
range {@code 0 <= index < size}.
*/
protected void validateIndex(final int index) {
if (index < 0 || index >= size) {
throw new StringIndexOutOfBoundsException(index);
}
}
+ /**
+ * Validates that an index is in the range {@code 0 <= index <= size} or
{@code 0 <= index < size}.
+ * @param index the index to test.
+ * @param includeEndInValidRange whether to include the end in the valid
range.
+ * @throws IndexOutOfBoundsException Thrown when index is not in the
chosen range.
+ */
+ protected void validateIndex(final int index, final boolean
includeEndInValidRange) {
Review Comment:
This is only called when the parameter is true. It should be updated to
remove the parameter and renamed, e.g. `validateIndexEndInclusive`, then
correct the javadoc as appropriate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]