Please review - 6984084 - String repeat()
Jim Gish
jim.gish at oracle.com
Thu Aug 16 08:10:44 PDT 2012
I'm removing the use of StringJoiner by String.repeat and as a result
moving the code for StringBuilder and String over to jdk8 and hence
review (when I have an update) to core-libs-dev. I'll retain the
StringJoiner.add( int, CharSequence ) here.
Stay tuned.
Thanks for the suggestions. You'll see some of them in the next round :-)
Cheers,
Jim
On 08/15/2012 09:54 PM, David Holmes wrote:
> Hi Jim,
>
> On 16/08/2012 4:41 AM, Jim Gish wrote:
>> Please review http://cr.openjdk.java.net/~jgish/6984084-StringRepeat/
>>
>> This in response to an old RFE to add either a new constructor or a
>> method to repeat a string, such as "*".repeat(5) resutling in "*****"
>>
>> There is nothing particularly lambda related in here other then the fact
>> that under the covers I'm using StringJoiner.
>
> I don't think this can, or should, only be discussed on lambda-dev.
>
> String is immutable so the docs there are wrong for the return value.
>
> I think n should be >=1. You only have a repeat if there are at least
> two copies of it: the original plus the repeated copy. So I don't like
> converting to empty string in any circumstances.
>
>> I'm happy with the name "repeat" but question the "addNcopies" method in
>> AbstractStringBuilder -- suggestions welcome.
>
> replicate seems appropriate to me.
>
> David
> -----
>
>>
>> Thanks,
>> Jim
>>
>> -- Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304
>> Oracle Java Platform Group | Core Libraries Team 35 Network Drive
>> Burlington, MA 01803 jim.gish at oracle.com
>>
--
Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304
Oracle Java Platform Group | Core Libraries Team
35 Network Drive
Burlington, MA 01803
jim.gish at oracle.com
More information about the lambda-dev
mailing list