Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7
Ulf.Zibis at gmx.de
Fri Oct 23 16:10:57 UTC 2009
Am 23.10.2009 17:51, Mark Reinhold schrieb:
>> Date: Fri, 23 Oct 2009 10:10:35 +0200
>> From: Rémi Forax <forax at univ-mlv.fr>
>> 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(String separator, Object objects);
>>> public static String join(String separator, Object first, Object... rest);
>>> with analogous methods in StringBuffer and StringBuilder return that type,
>>> respectively, instead of String?
>> I don't know. In my opinion, the main problem with join specified using
>> static methods is that split is not currently specified as a static
>> method. Because join is the dual of split, one could find the usage of
>> static methods weird.
> I agree. The join methods should be instance methods, not static methods.
Hm, but of what object. The result of the join method should be the
object, we are talking about, but it doesn't exist in advance, so only a
constructor could serve those needs.
We also have the pair:
public static String copyValueOf(char data)
public char toCharArray()
More information about the core-libs-dev