mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8276806: Use Objects.checkFromIndexSize where possible in java.base
Reviewed-by: rriggs, lancea
This commit is contained in:
parent
30087cc1b8
commit
73a9654c26
11 changed files with 40 additions and 43 deletions
|
@ -430,9 +430,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
|
|||
* {@code beginIndex} is larger than {@code endIndex}.
|
||||
*/
|
||||
public int codePointCount(int beginIndex, int endIndex) {
|
||||
if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
Preconditions.checkFromToIndex(beginIndex, endIndex, length(), null);
|
||||
if (isLatin1()) {
|
||||
return endIndex - beginIndex;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue