Please Review: 6984084 (str) n times repetition of character constructor for java.lang.String

Rémi Forax forax at univ-mlv.fr
Tue Aug 21 21:59:03 UTC 2012


On 08/21/2012 10:45 PM, Jim Gish wrote:
> Please review 
> http://cr.openjdk.java.net/~jgish/6984084-jdk8-StringRepeat/ 
> <http://cr.openjdk.java.net/%7Ejgish/6984084-jdk8-StringRepeat/>
>
> This started in lambda, making changes to both StringJoiner and 
> String.  However, the dependence of String.repeat() on StringJoiner 
> has been removed and the resulting non-lambda classes moved here for 
> review.  There will be a separate change and review for the 
> StringJoiner changes in lamda-dev.
>
> Thanks,
>    Jim
>

Hi Jim,

I think you should remove the line
   If {@code n == 1}, then the current {@code String} is returned.
from the javadoc of String because implementations should be free to use 
a StringBuilder,
so it's more a comment of the current implementation than a specification.

and nitpicking,
    throw new IllegalArgumentException( "n < 0");
should be (without the space)
    throw new IllegalArgumentException("n < 0");

otherwise, thumb up.

cheers,
Rémi



More information about the core-libs-dev mailing list