RFR: 8012665: CharSequence.chars, CharSequence.codePoints
martinrb at google.com
Thu Apr 25 23:14:03 UTC 2013
I think core library code should write the slightly lower-level code for
+ int cp = Character.codePointAt(CharSequence.this, cur);
+ cur += Character.charCount(cp);
int length = length();
if (cur == length) throw NSEE;
char c1 = charAt(cur++), c2;
if (!isHighSurrogate(c1) || cur == length || !isLowSurrogate(c2 =
return toCodePoint(c1, c2);
On Thu, Apr 25, 2013 at 1:25 PM, Henry Jen <henry.jen at oracle.com> wrote:
> Please review two default methods add to CharSequence returns IntStream
> of char value or code point value.
> The synchronization test is relieved so lambda and other synthetic
> method is not tested. If synchronization is needed for those two default
> methods, subclass should override the methods.
> With charAt and codePointAt properly synchronized, the default
> implementation is sufficient. However as noted, if the sequence is
> mutated while the stream is being read, the result is undefined.
More information about the core-libs-dev