RFR (JDK11) 8137326: Methods for comparing CharSequence, StringBuilder, and StringBuffer
scolebourne at joda.org
Fri Jan 26 15:01:56 UTC 2018
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
On 26 January 2018 at 03:00, Joe Wang <huizhe.wang at oracle.com> wrote:
> 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/
More information about the core-libs-dev