RFR (JDK11) 8137326: Methods for comparing CharSequence, StringBuilder, and StringBuffer
Joe Wang
huizhe.wang at oracle.com
Fri Jan 26 03:00:07 UTC 2018
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