RFR: JDK-8302323 Add repeat methods to StringBuilder/StringBuffer [v3]

Alan Bateman alanb at openjdk.org
Tue Feb 28 10:54:12 UTC 2023


On Mon, 27 Feb 2023 13:30:47 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> Add the ability to repeatedly append char and CharSequence data to StringBuilder/StringBuffer.
>
> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Optimize for empty CharSequence

src/java.base/share/classes/java/lang/AbstractStringBuilder.java line 1872:

> 1870:      * {@code CharSequence} length.
> 1871:      *
> 1872:      * @param cs     a {@code CharSequence}

append(CharSequence, int, int) has  "If s is null, then this method appends characters as if the s parameter was a sequence containing the four characters "null".". It looks like the proposal is to allow cs be null, in which case you'll need similar javadoc. In passing, append(CharSequence) is inheriting the method description from Appendable so it has the wrong parameter name.

-------------

PR: https://git.openjdk.org/jdk/pull/12728


More information about the core-libs-dev mailing list