Hi Jim,
Implementation looks good. I'd suggest a couple small editorial changes to the
spec:
2966 /**
2967 * Returns a string whose value is the concatenation of this
2968 * string repeated {@code count} times.
2969 * <p>
2970 * If count or length is zero then the empty string is returned.
I went looking for a 'length' parameter, until I realized it means the length of
*this string*. So maybe clarify that. (And also line 2977.)
2971 * <p>
2972 * This method may be used to create space padding for
2973 * formatting text or zero padding for formatting numbers.
I don't think having this text is necessary, but if you want it, I'd suggest
putting it into an @apiNote.
2974 * @param count number of times to repeat
2975 * @return A string composed of this string repeated
2976 * {@code count} times or the empty string if count
2977 * or length is zero.
Thanks,
s'marks
On 2/28/18 8:31 AM, Jim Laskey wrote:
Introduction of a new instance method String::repeat to allow an efficient and
concise approach for generating repeated character sequences as strings.
Performance information in JBS.
Thank you.
Cheers,
— Jim
JBS: https://bugs.openjdk.java.net/browse/JDK-8197594
<https://bugs.openjdk.java.net/browse/JDK-8197594>
CSR: https://bugs.openjdk.java.net/browse/JDK-8198296
<http://cr.openjdk.java.net/~jlaskey/8197594/String.html>
Webrev: http://cr.openjdk.java.net/~jlaskey/8197594/webrev-02/index.html
<http://cr.openjdk.java.net/~jlaskey/8197594/webrev-02/index.html>
JavaDoc: http://cr.openjdk.java.net/~jlaskey/8197594/String.html
<http://cr.openjdk.java.net/~jlaskey/8197594/String.html>