RFR (JDK11) 8137326: Methods for comparing CharSequence, StringBuilder, and StringBuffer

huizhe wang huizhe.wang at oracle.com
Fri Jan 26 21:48:30 UTC 2018

Thanks Stephen for the note.

I downloaded the api [1], but don't seem to see a class 
"DateTimeParseContext". Do you have a pointer to the current webrev? 
What does it do, and what would be the implication with regards to the 
CharSequence compare method?

[1] https://jcp.org/en/jsr/detail?id=310


On 1/26/2018 7:01 AM, Stephen Colebourne wrote:
> Just to note that JSR-310 had to add a CharSequence comparison method.
> Not the same as this one, but a data point, and perhaps a target to
> become public in a future webrev. See
> DateTimeParseContext.subSequenceEquals().
> Stephen
> On 26 January 2018 at 03:00, Joe Wang <huizhe.wang at oracle.com> wrote:
>> Hi,
>> Adding methods for comparing CharSequence, StringBuilder, and StringBuffer.
>> The Comparable implementations for StringBuilder/Buffer are similar to that
>> of String, allowing comparison operations between two
>> StringBuilders/Buffers, e.g. aStringBuilder.compareTo(anotherStringBuilder).
>> For CharSequence however, refer to the comments in JIRA, a static method
>> 'compare' is added instead of implementing the Comparable interface. This
>> 'compare' method may take CharSequence implementations such as String,
>> StringBuilder and StringBuffer, making it possible to perform comparison
>> among them. The previous example for example is equivalent to
>> CharSequence.compare(aStringBuilder, anotherStringBuilder).
>> Tests for java.base have been independent from each other. The new tests are
>> therefore created to have no dependency on each other or sharing any code.
>> JBS: https://bugs.openjdk.java.net/browse/JDK-8137326
>> webrev: http://cr.openjdk.java.net/~joehw/jdk11/8137326/webrev/
>> Thanks,
>> Joe

More information about the core-libs-dev mailing list