<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Code idiom: inserting a separator between the elements in a list</title>
	<atom:link href="http://madbean.com/2003/mb2003-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://madbean.com/2003/mb2003-2/</link>
	<description>Your zero step program</description>
	<pubDate>Fri, 05 Sep 2008 17:06:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Simon Brunning</title>
		<link>http://madbean.com/2003/mb2003-2/#comment-47</link>
		<dc:creator>Simon Brunning</dc:creator>
		<pubDate>Thu, 29 Apr 2004 11:21:48 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2003-2#comment-47</guid>
		<description>&lt;p&gt;Nice - but don't reinvent the wheel: http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringUtils.html#join(java.util.Iterator, java.lang.String)&lt;/p&gt;

&lt;p&gt;Hmmm, funny URL with a space in it.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Nice - but don&#8217;t reinvent the wheel: <a href="http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringUtils.html#join" rel="nofollow">http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringUtils.html#join</a>(java.util.Iterator, java.lang.String)</p>
<p>Hmmm, funny URL with a space in it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel Hockey</title>
		<link>http://madbean.com/2003/mb2003-2/#comment-46</link>
		<dc:creator>Joel Hockey</dc:creator>
		<pubDate>Tue, 11 Mar 2003 04:42:55 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2003-2#comment-46</guid>
		<description>&lt;p&gt;Nice.  I often use the following idiom as well:&lt;/p&gt;

&lt;p&gt;&#60;pre&#62;
StringBuffer sb = new StringBuffer();
List l = ...;
String sep = &#34;,&#34;;
for (Iterator i = l.iterator(); i.hasNext(); ) {
    String s = (String) i.next();
    sb.append(s).append(sep);
}&lt;/p&gt;

&lt;p&gt;return out.substring(0, sb.length() - sep.length());
&#60;/pre&#62;
I like it because it is a little more explicit, but without any conditional processing within a loop.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Nice.  I often use the following idiom as well:</p>
<p>&lt;pre&gt;<br />
StringBuffer sb = new StringBuffer();<br />
List l = &#8230;;<br />
String sep = &quot;,&quot;;<br />
for (Iterator i = l.iterator(); i.hasNext(); ) {<br />
    String s = (String) i.next();<br />
    sb.append(s).append(sep);<br />
}</p>
<p>return out.substring(0, sb.length() - sep.length());<br />
&lt;/pre&gt;<br />
I like it because it is a little more explicit, but without any conditional processing within a loop.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan</title>
		<link>http://madbean.com/2003/mb2003-2/#comment-45</link>
		<dc:creator>Ivan</dc:creator>
		<pubDate>Tue, 25 Feb 2003 00:07:34 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2003-2#comment-45</guid>
		<description>&lt;p&gt;I've used this same fellow as far back as I can remember, but I always felt dirty about:
a) Wasted effort appending a blank string for the first iteration.
b) Subsequent redundant assignments to the sep variable.&lt;/p&gt;

&lt;p&gt;Sure, I feel bad, but it's still my hammer for every nail.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;ve used this same fellow as far back as I can remember, but I always felt dirty about:<br />
a) Wasted effort appending a blank string for the first iteration.<br />
b) Subsequent redundant assignments to the sep variable.</p>
<p>Sure, I feel bad, but it&#8217;s still my hammer for every nail.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://madbean.com/2003/mb2003-2/#comment-44</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Sat, 22 Feb 2003 15:11:51 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2003-2#comment-44</guid>
		<description>&lt;p&gt;Very elegant.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Very elegant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philippe</title>
		<link>http://madbean.com/2003/mb2003-2/#comment-43</link>
		<dc:creator>Philippe</dc:creator>
		<pubDate>Sat, 22 Feb 2003 09:19:36 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2003-2#comment-43</guid>
		<description>&lt;p&gt;Totally agreed... a programmer on my team did it last week when he wrote the utility function to convert collections to such strings and vice-versa... I was pleasently surprised :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Totally agreed&#8230; a programmer on my team did it last week when he wrote the utility function to convert collections to such strings and vice-versa&#8230; I was pleasently surprised :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce</title>
		<link>http://madbean.com/2003/mb2003-2/#comment-42</link>
		<dc:creator>Bruce</dc:creator>
		<pubDate>Fri, 21 Feb 2003 14:14:12 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2003-2#comment-42</guid>
		<description>&lt;p&gt;Can this be done by 'Separation of Concerns'&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Can this be done by &#8216;Separation of Concerns&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://madbean.com/2003/mb2003-2/#comment-41</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Fri, 21 Feb 2003 07:20:17 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2003-2#comment-41</guid>
		<description>&lt;p&gt;Agreed, great tip.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Agreed, great tip.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oliver</title>
		<link>http://madbean.com/2003/mb2003-2/#comment-40</link>
		<dc:creator>Oliver</dc:creator>
		<pubDate>Fri, 21 Feb 2003 06:01:32 +0000</pubDate>
		<guid isPermaLink="false">http://madbean.com/blog/2003-2#comment-40</guid>
		<description>&lt;p&gt;Sweet - I really like that tip.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Sweet - I really like that tip.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
