Compare commits

...

2 Commits

Author SHA1 Message Date
Tatsunori Uchino
9af51fc7d0
Remove Character.codePointCount overload 2026-01-27 19:55:55 +09:00
Tatsunori Uchino
6d2805d358
Rename parameter names from a to seq
`chars` is too confusing with `char`
2026-01-27 12:44:32 +09:00

View File

@ -9952,28 +9952,6 @@ class Character implements java.io.Serializable, Comparable<Character>, Constabl
return n;
}
/**
* Returns the number of Unicode code points in the text range of
* the specified char sequence. Unpaired surrogates count as one
* code point each.
*
* @param seq the char sequence
* @return the number of Unicode code points in the char sequence
* @throws NullPointerException if {@code seq} is null.
* @since 26
*/
public static int codePointCount(CharSequence seq) {
final int length = seq.length();
int n = length;
for (int i = 0; i < length; ) {
if (isHighSurrogate(seq.charAt(i++)) && i < length &&
isLowSurrogate(seq.charAt(i))) {
n--;
i++;
}
}
return n;
}
/**
* Returns the number of Unicode code points in a subarray of the
@ -10003,12 +9981,12 @@ class Character implements java.io.Serializable, Comparable<Character>, Constabl
* {@return the number of Unicode code points in the {@code char} array}
* Unpaired surrogates count as one code point each.
*
* @param a the {@code char} array
* @throws NullPointerException if {@code a} is null
* @param seq the {@code char} array
* @throws NullPointerException if {@code seq} is null
* @since 27
*/
public static int codePointCount(char[] a) {
return codePointCountImpl(a, 0, a.length);
public static int codePointCount(char[] seq) {
return codePointCountImpl(seq, 0, seq.length);
}
static int codePointCountImpl(char[] a, int offset, int count) {