RFR: 8012665: CharSequence.chars, CharSequence.codePoints
Henry Jen
henry.jen at oracle.com
Mon Apr 29 16:51:47 UTC 2013
On 04/26/2013 06:21 AM, Alan Bateman wrote:
> On 25/04/2013 21:25, Henry Jen wrote:
>> Hi,
>>
>> Please review two default methods add to CharSequence returns IntStream
>> of char value or code point value.
>>
>> http://cr.openjdk.java.net/~henryjen/tl/8012665.0/webrev/
>>
>> 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.
>>
>> Cheers,
>> Henry
> I looked through the webrev and it looks okay as a first version. I
> agree with Martin's suggestion on the performance. I also wonder if
> CharBuffer will need to override at least chars(). This could of course
> be done as a follow-on piece of work.
>
I agree, let's follow up on this after first version.
> In TestSynchronization then I assume the commented System.out should be
> removed.
>
I will remove it.
More information about the core-libs-dev
mailing list