Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: markspace Newsgroups: comp.lang.java.programmer Subject: Re: simple StringBuilder proposal Date: Tue, 26 Feb 2013 08:31:16 -0800 Organization: A noiseless patient Spider Lines: 36 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 26 Feb 2013 16:30:08 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="fba3415ba68d85d643935af2f52f0b4b"; logging-data="6018"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jLqUl1K2BnJ0fvEtod8buTzyfaIIkgJk=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 In-Reply-To: Cancel-Lock: sha1:kHjGK8T+RFt+0B7Jt+3NnFomL4M= Xref: csiph.com comp.lang.java.programmer:22537 On 2/26/2013 3:53 AM, Roedy Green wrote: > sb.append( " ":", cseCode, "\">\n" ); > > It is just shorthand for > > sb.append( " sb.append(cseAccount); > sb.append(":"); > sb.append(cseCode); > sb.append( "\">\n" ); > > I propose StringBuilder learn the same trick. > I think I see what you are saying. Java 8 is "in the chute" *right now*, so it might be timely to send in an enhancement request. I don't think they're feature complete yet. Send some sample code that does what you ask, I think it helps move the process along and promotes understanding also: public class StringBuilderUtils { private StringBuilderUtils() {} /** Example only, should be an instance method on StringBuilder * rather than a static method. */ public static void append( StringBuilder sb, Object... toAppend ) { for( Object o : toAppend ) sb.append( o ); } } Not tested or even compiled....