Re: RFR: String.join(), StringJoiner additions

2013-04-19 Thread Jim Gish
Hi Henry, Can you please comment on the simplifications you did ? Thanks, Jim On 04/18/2013 07:38 PM, Ulf Zibis wrote: Am 18.04.2013 19:37, schrieb Jim Gish: On 04/18/2013 08:49 AM, Ulf Zibis wrote: Hi, I'm wondering, that StringJoiner has some logic for pre/suffix, but nothing to

Re: RFR: String.join(), StringJoiner additions

2013-04-19 Thread Jim Gish
Martin, I've updated the toString() method as you suggested. http://cr.openjdk.java.net/~jgish/Bugs-5015163-7172553/ http://cr.openjdk.java.net/%7Ejgish/Bugs-5015163-7172553/ Thanks, Jim On 04/18/2013 05:02 PM, Martin Buchholz wrote: On Thu, Apr 18, 2013 at 10:34 AM, Jim Gish

Re: RFR: String.join(), StringJoiner additions

2013-04-18 Thread Alan Bateman
On 17/04/2013 22:49, Jim Gish wrote: Here's an update: http://cr.openjdk.java.net/~jgish/Bugs-5015163-7172553/ http://cr.openjdk.java.net/%7Ejgish/Bugs-5015163-7172553/ Jim StringJoiner looks much better now, good to see it reduced down to 2 simple constructors. One thing that I didn't

Re: RFR: String.join(), StringJoiner additions

2013-04-18 Thread Ulf Zibis
Hi, I don't think it's worth to add the braces at lines 2359..2360. Please swap lines 2740 - 2739. -Ulf Am 18.04.2013 03:20, schrieb Roger Riggs: Hi, Can I suggest that the StringJoiner.toString() method explicitly append the suffix to the existing StringBuilder. 152 return

Re: RFR: String.join(), StringJoiner additions

2013-04-18 Thread Ulf Zibis
Hi, I'm wondering, that StringJoiner has some logic for pre/suffix, but nothing to loop the elements themselves :-( To me, StringJoiner is a useless complicated box around StringBuilder, and imagine, someone needs thread-safety. It also slows down performance, as it needs additional

Re: RFR: String.join(), StringJoiner additions

2013-04-18 Thread Jim Gish
That was a nice idea, but you don't want to change the value when you do toString(). Otherwise, if you subsequently add a new element, you're hosed because you've already added on the suffix. Jim On 04/17/2013 09:20 PM, Roger Riggs wrote: Hi, Can I suggest that the StringJoiner.toString()

Re: RFR: String.join(), StringJoiner additions

2013-04-18 Thread Jim Gish
On 04/18/2013 08:49 AM, Ulf Zibis wrote: Hi, I'm wondering, that StringJoiner has some logic for pre/suffix, but nothing to loop the elements themselves :-( To me, StringJoiner is a useless complicated box around StringBuilder, and imagine, someone needs thread-safety. It also slows down

Re: RFR: String.join(), StringJoiner additions

2013-04-18 Thread Martin Buchholz
On Thu, Apr 18, 2013 at 10:34 AM, Jim Gish jim.g...@oracle.com wrote: That was a nice idea, but you don't want to change the value when you do toString(). Otherwise, if you subsequently add a new element, you're hosed because you've already added on the suffix. You can cheaply save the

Re: RFR: String.join(), StringJoiner additions

2013-04-18 Thread Martin Buchholz
Garbled javadoc: 41 * method will, by default, return {@code prefix+{@code suffix}}. However, if

Re: RFR: String.join(), StringJoiner additions

2013-04-18 Thread Jim Gish
Thanks for catching that. I thought I fixed it. (In fact, I'm sure I did in the latest rev). On 04/18/2013 05:03 PM, Martin Buchholz wrote: Garbled javadoc: 41 * method will, by default, return {@code prefix+{@code suffix}}. However, if -- Jim Gish | Consulting Member of

Re: RFR: String.join(), StringJoiner additions

2013-04-18 Thread Ulf Zibis
Am 18.04.2013 19:37, schrieb Jim Gish: On 04/18/2013 08:49 AM, Ulf Zibis wrote: Hi, I'm wondering, that StringJoiner has some logic for pre/suffix, but nothing to loop the elements themselves :-( To me, StringJoiner is a useless complicated box around StringBuilder, and imagine, someone

Re: RFR: String.join(), StringJoiner additions

2013-04-17 Thread Jim Gish
I'm going to rip out the /li then. It's an unnecessary burden. Thanks Jim On 04/16/2013 06:50 PM, Mike Duigou wrote: On Apr 16 2013, at 08:50 , Alan Bateman wrote: On 16/04/2013 16:13, Jim Gish wrote: On 04/15/2013 02:02 PM, Martin Buchholz wrote: You are fiddling with the javadoc for

Re: RFR: String.join(), StringJoiner additions

2013-04-17 Thread Mike Duigou
String:: line 1253: This should use {@code } rather than code/code. I think regular spaces are OK as well. nbsp; seems inappropriate. lines 2425/2467: elements may not be null either. I can tell you (or maybe it's just me) are itching to change : for (CharSequence cs: elements) { 2477

Re: RFR: String.join(), StringJoiner additions

2013-04-17 Thread Jim Gish
Here's an update: http://cr.openjdk.java.net/~jgish/Bugs-5015163-7172553/ http://cr.openjdk.java.net/%7Ejgish/Bugs-5015163-7172553/ Jim On 04/17/2013 03:15 PM, Mike Duigou wrote: String:: line 1253: This should use {@code } rather than code/code. I think regular spaces are OK as well.

Re: RFR: String.join(), StringJoiner additions

2013-04-17 Thread Martin Buchholz
I'm still wondering about whether a joiner utility should support a prefix and suffix. The obvious uses for this are collection class toString methods, but we already know that we can and should implement those with a single precise char[] construction, so should not use StringJoiner, or at least

Re: RFR: String.join(), StringJoiner additions

2013-04-17 Thread Jim Gish
I'm open to this, but am interested in what others have to say, especially as it relates to other lambda features coming in. Bear in mind that this is at least the third major round of reviews for these changes, the first round being a year ago on lambda-dev, when I first submitted them, and

Re: RFR: String.join(), StringJoiner additions

2013-04-17 Thread Brian Goetz
The motivation was indeed that it would support more efficient Collection.toString. (But, I don't believe anything actually uses that feature right now, other than tests.) Even if *our* implementations were not to use this because we had a better for-experts construction, I still think this

Re: RFR: String.join(), StringJoiner additions

2013-04-17 Thread Roger Riggs
Hi, Can I suggest that the StringJoiner.toString() method explicitly append the suffix to the existing StringBuilder. 152 return (value != null ? value.toString() + suffix : emptyValue); Currently it will go to the trouble of creating a String from the builder and then

Re: RFR: String.join(), StringJoiner additions

2013-04-17 Thread Martin Buchholz
To be concrete, here's a proposed toString method : http://cr.openjdk.java.net/~martin/webrevs/openjdk8/toString/ which is pretty good as it stands, but even better once it gets to use the no-copy String constructor.

Re: RFR: String.join(), StringJoiner additions

2013-04-17 Thread Mike Duigou
If I don't get a chance to revisit the whole UUID optimization patch soon I will see what I can do about breaking it up further and maybe just do the no-copy String constructor by itself. Mike On Apr 17 2013, at 20:29 , Martin Buchholz wrote: To be concrete, here's a proposed toString method

Re: RFR: String.join(), StringJoiner additions

2013-04-16 Thread Jim Gish
On 04/15/2013 02:02 PM, Martin Buchholz wrote: You are fiddling with the javadoc for getChars, which is an independent change. (I am also fiddling with getChars in another ongoing change). I don't think closing html tags for li are required in javadoc. If you are going to change the

Re: RFR: String.join(), StringJoiner additions

2013-04-16 Thread Mike Duigou
On Apr 16 2013, at 08:50 , Alan Bateman wrote: On 16/04/2013 16:13, Jim Gish wrote: On 04/15/2013 02:02 PM, Martin Buchholz wrote: You are fiddling with the javadoc for getChars, which is an independent change. (I am also fiddling with getChars in another ongoing change). I don't

Re: RFR: String.join(), StringJoiner additions

2013-04-15 Thread Alan Bateman
On 12/04/2013 16:02, Alan Bateman wrote: On 11/04/2013 23:33, Jim Gish wrote: Please review http://cr.openjdk.java.net/~jgish/Bugs-5015163-7175206-7172553/ http://cr.openjdk.java.net/%7Ejgish/Bugs-5015163-7175206-7172553/ These are changes that we made in lambda that we're now bringing into

Re: RFR: String.join(), StringJoiner additions

2013-04-15 Thread Martin Buchholz
You are fiddling with the javadoc for getChars, which is an independent change. (I am also fiddling with getChars in another ongoing change). I don't think closing html tags for li are required in javadoc. If you are going to change the exception javadoc, then also change @exception to @throws.

Re: RFR: String.join(), StringJoiner additions

2013-04-15 Thread Martin Buchholz
Is i+1 really preferred to i + 1 ? I thought it was the reverse, and that i+1 was merely tolerated. 1570 if (value[i] == hi value[i+1] == lo) { --- 2425 * @throws NullPointerException If {@code delimiter} is {@code null} you also throw NPE for element null, but you

Re: RFR: String.join(), StringJoiner additions

2013-04-15 Thread Martin Buchholz
It is natural to compare StringJoiner with guava Joiner. http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Joiner.html Joiner is popular and has stood the test of time. Joiner designers chose not to include a prefix and suffix, presumably because that is an independent

Re: RFR: String.join(), StringJoiner additions

2013-04-15 Thread Martin Buchholz
On Mon, Apr 15, 2013 at 11:31 AM, Martin Buchholz marti...@google.comwrote: OTOH, I'm guessing you are trying to improve the performance of operations like List.toString. More efficient (single copy char[]) would be to collect all the sub-CharSequences in a CharSequence[], pre-compute the

Re: RFR: String.join(), StringJoiner additions

2013-04-15 Thread Steven Schlansker
On Apr 15, 2013, at 12:21 PM, Martin Buchholz marti...@google.com wrote: On Mon, Apr 15, 2013 at 11:31 AM, Martin Buchholz marti...@google.comwrote: OTOH, I'm guessing you are trying to improve the performance of operations like List.toString. More efficient (single copy char[]) would be

Re: RFR: String.join(), StringJoiner additions

2013-04-15 Thread Martin Buchholz
Thanks for the pointer. Yeah, that's one the pieces I think we should have to do an optimal job of rewriting collection toString methods. On Mon, Apr 15, 2013 at 1:03 PM, Steven Schlansker stevenschlans...@gmail.com wrote: On Apr 15, 2013, at 12:21 PM, Martin Buchholz marti...@google.com

Re: RFR: String.join(), StringJoiner additions

2013-04-15 Thread Mike Duigou
On Apr 15 2013, at 13:03 , Steven Schlansker wrote: On Apr 15, 2013, at 12:21 PM, Martin Buchholz marti...@google.com wrote: On Mon, Apr 15, 2013 at 11:31 AM, Martin Buchholz marti...@google.comwrote: OTOH, I'm guessing you are trying to improve the performance of operations like

Re: RFR: String.join(), StringJoiner additions

2013-04-12 Thread Alan Bateman
On 11/04/2013 23:33, Jim Gish wrote: Please review http://cr.openjdk.java.net/~jgish/Bugs-5015163-7175206-7172553/ http://cr.openjdk.java.net/%7Ejgish/Bugs-5015163-7175206-7172553/ These are changes that we made in lambda that we're now bringing into JDK8. I've made a couple of additions -

RFR: String.join(), StringJoiner additions

2013-04-11 Thread Jim Gish
Please review http://cr.openjdk.java.net/~jgish/Bugs-5015163-7175206-7172553/ http://cr.openjdk.java.net/%7Ejgish/Bugs-5015163-7175206-7172553/ These are changes that we made in lambda that we're now bringing into JDK8. I've made a couple of additions - making StringJoiner final and adding a