Re: Strings [was Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7]

2009-11-08 Thread Kevin Bourrillion
On Mon, Oct 26, 2009 at 1:38 PM, Stephen Colebourne wrote: Unfortunately, the null-handling behaviour of the static method is > considered a feature to many That is unfortunate.Luckily any new JDK methods would not have to carry forward the null-tolerant approach. :-) By the way, one advan

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-27 Thread Ulf Zibis
Neal, thanks for your patience. Yes, these are the arguments I understand. Thanks a lot, -Ulf Am 27.10.2009 17:36, Neal Gafter schrieb: Ulf- Very good. How what happens if you change the return type, or add a throws clause, or change its access modifier (JLS 8.4.8.3)? In all three cases

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-27 Thread Neal Gafter
Ulf- Very good. How what happens if you change the return type, or add a throws clause, or change its access modifier (JLS 8.4.8.3)? In all three cases it must be a compile-time error. -Neal On Tue, Oct 27, 2009 at 8:13 AM, Ulf Zibis wrote: > It works fine too. > Is coded: > > > public class

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-27 Thread Ulf Zibis
It works fine too. Is coded: public class MyClass1 { private final int value; public MyClass1(int value) { this.value = value; } public static int hashCode(Object key) { return 3; } //public static int hashCode(MyClass1 obj) { //return 3 * obj.value; //

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-27 Thread Neal Gafter
Try adding public static hashCode(Object key) { return 3; } to MyClass. Such a class is broken by the proposed change. On Tue, Oct 27, 2009 at 2:49 AM, Ulf Zibis wrote: > Correction: > > > public class MyClass1 { > private final int value; > > public MyClass1(int value) { > t

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-27 Thread Ulf Zibis
Correction: public class MyClass1 { private final int value; public MyClass1(int value) { this.value = value; } public static int hashCode(MyClass1 obj) { return 3 * obj.value; } public static void main(String... args) { MyClass1 c = new MyClass1(99); System

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-27 Thread Ulf Zibis
Am 26.10.2009 18:43, Joseph D. Darcy schrieb: Neal Gafter wrote: You can hardly add any methods to Object, event static methods, without breaking compatibility, because they get added to every the overload set if the name is used for methods in existing code. Indeed, which is why these method

Strings [was Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7]

2009-10-26 Thread Stephen Colebourne
Joseph D. Darcy wrote: Stephen Colebourne wrote: Joe, would you be prepared to sponsor a Strings class, and see join on there instead of String? No. While I believe a "StringUtils" class would have been appropriate early in the platform's life to host more advanced string manipulation facil

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-26 Thread David Holmes
Joseph D. Darcy wrote: Neal Gafter wrote: You can hardly add any methods to Object, event static methods, without breaking compatibility, because they get added to every the overload set if the name is used for methods in existing code. Indeed, which is why these methods were added in a new c

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-26 Thread Joseph D. Darcy
Neal Gafter wrote: You can hardly add any methods to Object, event static methods, without breaking compatibility, because they get added to every the overload set if the name is used for methods in existing code. Indeed, which is why these methods were added in a new class to prevent unwante

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-26 Thread Neal Gafter
You can hardly add any methods to Object, event static methods, without breaking compatibility, because they get added to every the overload set if the name is used for methods in existing code. On Mon, Oct 26, 2009 at 9:29 AM, David Holmes wrote: > Joseph D. Darcy wrote: > > Stephen Colebourne

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-26 Thread David Holmes
Joseph D. Darcy wrote: Stephen Colebourne wrote: Joe, would you be prepared to sponsor a Strings class, and see join on there instead of String? No. +1. It was necessary to introduce Arrays and Collections for utility methods because there was no place else to locate the static methods.

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-26 Thread Joseph D. Darcy
Stephen Colebourne wrote: Not wishing to confuse the debate, but perhaps the correct place for this is a static Strings class, that parallels Objects. We all know that there are lots of possible methods for such a class, but even if JDK7 had just a few, that would be a good start. Joe, would yo

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-26 Thread Ulf Zibis
Am 26.10.2009 14:01, Stephen Colebourne schrieb: Not wishing to confuse the debate, but perhaps the correct place for this is a static Strings class, that parallels Objects. -1 Doing this consequently we could have for each "normal" class 'ClassName' it's static helper class 'ClassNames',

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-26 Thread Stephen Colebourne
Not wishing to confuse the debate, but perhaps the correct place for this is a static Strings class, that parallels Objects. We all know that there are lots of possible methods for such a class, but even if JDK7 had just a few, that would be a good start. Joe, would you be prepared to sponsor a S

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-23 Thread Kevin Bourrillion
FYI, While I certainly love my "Joiner" baby, and while y'all have blanket permission to make use of any of our code you want, I think it's entirely appropriate for the JDK to just hit the 80% case with a static method directly on String. (And yes, the fact that split() is an instance method is a

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-23 Thread Joseph D. Darcy
Yes, to my aesthetics the static call join(" ", "A", "call", "to"); is more sensible looking than " ".join("A", "call", "to"); Especially when a call like " ".join("Foo") will not have " " in the returned String. However, the platform would certainly be improved with any version o

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-23 Thread Ulf Zibis
Am 23.10.2009 17:51, Mark Reinhold schrieb: Date: Fri, 23 Oct 2009 10:10:35 +0200 From: Rémi Forax Le 23/10/2009 03:53, Joe Darcy a écrit : Following up on this, what is the exact revised proposal? In java.lang.String: public static String join(String separator, Iterable ob

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-23 Thread Joe Kearney
Hi, >From the peanut gallery, it seems to me that there is a genuine reason to leave join as a static method (if we're not going after the google-collections approach of a Joiner class

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-23 Thread Mark Reinhold
> Date: Fri, 23 Oct 2009 10:10:35 +0200 > From: Rémi Forax > Le 23/10/2009 03:53, Joe Darcy a écrit : >> Following up on this, what is the exact revised proposal? >> >> In java.lang.String: >> >>public static String join(String separator, Iterable objects); >>public static String join(S

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-23 Thread Rémi Forax
Le 23/10/2009 03:53, Joe Darcy a écrit : Joe Darcy wrote: Rémi Forax wrote: Le 14/10/2009 01:32, Joseph D. Darcy a écrit : Hello. Following up from threads earlier this year, http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-February/001061.html http://mail.openjdk.java.net/piperma

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-22 Thread Wang Weijun
Anyone will really use the single Object argument version? There's nothing to join here. - Max --- Original message --- From: Joe Darcy Cc: core-libs-dev@openjdk.java.net Sent: 23.10.'09, 9:49 Joe Darcy wrote: public static String join(String separator, Iterable objects); publ

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-22 Thread Joe Darcy
Joe Darcy wrote: Rémi Forax wrote: Le 14/10/2009 01:32, Joseph D. Darcy a écrit : Hello. Following up from threads earlier this year, http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-February/001061.html http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-March/001191.html

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-15 Thread Joe Darcy
Rémi Forax wrote: Le 14/10/2009 01:32, Joseph D. Darcy a écrit : Hello. Following up from threads earlier this year, http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-February/001061.html http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-March/001191.html I'm willing and

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-14 Thread David Schlosnagle
Hi Rémi, One quick comment on AbstractStringBuilder.join(String, Object, Object...) -- I'd propose to check that 'elements' is not null prior to appending 'first' so that if the preconditions are violated and the NullPointerException is thrown, there are no side effects. This would also be a nice

Re: Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-14 Thread Rémi Forax
Le 14/10/2009 01:32, Joseph D. Darcy a écrit : Hello. Following up from threads earlier this year, http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-February/001061.html http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-March/001191.html I'm willing and interested to spons

Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

2009-10-13 Thread Joseph D. Darcy
Hello. Following up from threads earlier this year, http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-February/001061.html http://mail.openjdk.java.net/pipermail/core-libs-dev/2009-March/001191.html I'm willing and interested to sponsor getting String.join functionality into JDK 7. T