<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Effective Java Collections</title>
	<atom:link href="http://thermopylae.net/blog/2008/08/10/basic-tips-for-using-the-java-collections-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://thermopylae.net/blog/2008/08/10/basic-tips-for-using-the-java-collections-framework/</link>
	<description>Do I know what a rhetorical question is?</description>
	<lastBuildDate>Fri, 26 Mar 2010 16:40:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: admin</title>
		<link>http://thermopylae.net/blog/2008/08/10/basic-tips-for-using-the-java-collections-framework/comment-page-1/#comment-346</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 02 Nov 2009 16:16:46 +0000</pubDate>
		<guid isPermaLink="false">http://thermopylae.net/blog/?p=40#comment-346</guid>
		<description>Sure. You want to use interfaces as much as possible instead of concrete classes whenever it makes sense.

Suppose that you write your code and then realize that because of performance concerns, you don&#039;t actually want to use an ArrayList, you&#039;d rather use a LinkedList. To an outside user the behavior of both is the same (they conform to the List interface) but the implementation is different. If foo was an ArrayList, then you have to change it everywhere that its used - which means touching a lot of code that you don&#039;t mean to change. If foo is a List, then this is the only line you need to change.

For this specific use case its not a huge deal, but it helps you keep this concept in mind as you do more complex classes.

Check out this interview with Erich Gamma: &lt;a href=&quot;http://www.artima.com/lejava/articles/designprinciples.html&quot; rel=&quot;nofollow&quot;&gt;http://www.artima.com/lejava/articles/designprinciples.html&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Sure. You want to use interfaces as much as possible instead of concrete classes whenever it makes sense.</p>
<p>Suppose that you write your code and then realize that because of performance concerns, you don&#8217;t actually want to use an ArrayList, you&#8217;d rather use a LinkedList. To an outside user the behavior of both is the same (they conform to the List interface) but the implementation is different. If foo was an ArrayList, then you have to change it everywhere that its used &#8211; which means touching a lot of code that you don&#8217;t mean to change. If foo is a List, then this is the only line you need to change.</p>
<p>For this specific use case its not a huge deal, but it helps you keep this concept in mind as you do more complex classes.</p>
<p>Check out this interview with Erich Gamma: <a href="http://www.artima.com/lejava/articles/designprinciples.html" rel="nofollow">http://www.artima.com/lejava/articles/designprinciples.html</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: j2ee</title>
		<link>http://thermopylae.net/blog/2008/08/10/basic-tips-for-using-the-java-collections-framework/comment-page-1/#comment-345</link>
		<dc:creator>j2ee</dc:creator>
		<pubDate>Thu, 22 Oct 2009 14:41:43 +0000</pubDate>
		<guid isPermaLink="false">http://thermopylae.net/blog/?p=40#comment-345</guid>
		<description>Can you please explain why should The left side always an interface!, and not do this: ArrayList foo = new ArrayList();</description>
		<content:encoded><![CDATA[<p>Can you please explain why should The left side always an interface!, and not do this: ArrayList foo = new ArrayList();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: User links about "javadocs" on iLinkShare</title>
		<link>http://thermopylae.net/blog/2008/08/10/basic-tips-for-using-the-java-collections-framework/comment-page-1/#comment-257</link>
		<dc:creator>User links about "javadocs" on iLinkShare</dc:creator>
		<pubDate>Fri, 08 May 2009 17:18:28 +0000</pubDate>
		<guid isPermaLink="false">http://thermopylae.net/blog/?p=40#comment-257</guid>
		<description>[...] effects library&gt;&gt; saved by LisaMD4414 2 days ago6 votesJava&gt;&gt; saved by mrklaw 10 days ago2 votesEffective Java Collections&gt;&gt; saved by T1o2b3i 28 days ago4 votessvn: Unable to open an ra_local session to URL&gt;&gt; saved by [...]</description>
		<content:encoded><![CDATA[<p>[...] effects library&gt;&gt; saved by LisaMD4414 2 days ago6 votesJava&gt;&gt; saved by mrklaw 10 days ago2 votesEffective Java Collections&gt;&gt; saved by T1o2b3i 28 days ago4 votessvn: Unable to open an ra_local session to URL&gt;&gt; saved by [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Recent Links Tagged With "javadocs" - JabberTags</title>
		<link>http://thermopylae.net/blog/2008/08/10/basic-tips-for-using-the-java-collections-framework/comment-page-1/#comment-243</link>
		<dc:creator>Recent Links Tagged With "javadocs" - JabberTags</dc:creator>
		<pubDate>Tue, 28 Apr 2009 05:49:19 +0000</pubDate>
		<guid isPermaLink="false">http://thermopylae.net/blog/?p=40#comment-243</guid>
		<description>[...] public links &gt;&gt; javadocs   Effective Java Collections Saved by Jeremyisfedup on Fri 10-4-2009   Sun OpenSSO Enterprise Saved by LonelyDemon on Fri [...]</description>
		<content:encoded><![CDATA[<p>[...] public links &gt;&gt; javadocs   Effective Java Collections Saved by Jeremyisfedup on Fri 10-4-2009   Sun OpenSSO Enterprise Saved by LonelyDemon on Fri [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Websites tagged "oodesign" on Postsaver</title>
		<link>http://thermopylae.net/blog/2008/08/10/basic-tips-for-using-the-java-collections-framework/comment-page-1/#comment-6</link>
		<dc:creator>Websites tagged "oodesign" on Postsaver</dc:creator>
		<pubDate>Wed, 17 Sep 2008 21:17:36 +0000</pubDate>
		<guid isPermaLink="false">http://thermopylae.net/blog/?p=40#comment-6</guid>
		<description>[...] - Effective Java Collections saved by Lindaru2008-09-11 - Code reuse possibilities? saved by allenY2008-08-28 - Achieving Model [...]</description>
		<content:encoded><![CDATA[<p>[...] &#8211; Effective Java Collections saved by Lindaru2008-09-11 &#8211; Code reuse possibilities? saved by allenY2008-08-28 &#8211; Achieving Model [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: betweenGo &#187; Effective Java Collections</title>
		<link>http://thermopylae.net/blog/2008/08/10/basic-tips-for-using-the-java-collections-framework/comment-page-1/#comment-4</link>
		<dc:creator>betweenGo &#187; Effective Java Collections</dc:creator>
		<pubDate>Mon, 01 Sep 2008 22:54:13 +0000</pubDate>
		<guid isPermaLink="false">http://thermopylae.net/blog/?p=40#comment-4</guid>
		<description>[...] thought this article, Effective Java Collections, was excellent.  Here is the summary of the [...]</description>
		<content:encoded><![CDATA[<p>[...] thought this article, Effective Java Collections, was excellent.  Here is the summary of the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Currie</title>
		<link>http://thermopylae.net/blog/2008/08/10/basic-tips-for-using-the-java-collections-framework/comment-page-1/#comment-3</link>
		<dc:creator>Christopher Currie</dc:creator>
		<pubDate>Thu, 14 Aug 2008 22:39:47 +0000</pubDate>
		<guid isPermaLink="false">http://thermopylae.net/blog/?p=40#comment-3</guid>
		<description>Curse your non-HTML escaping comment forms, I did use generics in those examples!</description>
		<content:encoded><![CDATA[<p>Curse your non-HTML escaping comment forms, I did use generics in those examples!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Currie</title>
		<link>http://thermopylae.net/blog/2008/08/10/basic-tips-for-using-the-java-collections-framework/comment-page-1/#comment-2</link>
		<dc:creator>Christopher Currie</dc:creator>
		<pubDate>Thu, 14 Aug 2008 22:38:52 +0000</pubDate>
		<guid isPermaLink="false">http://thermopylae.net/blog/?p=40#comment-2</guid>
		<description>If you&#039;re not constrained to the Java Standard Library, I would prefer to use Google Collections &quot;Immutable&quot; collection objects, for empty collections or otherwise:

List myEmptyList = com.google.common.collect.ImmutableList.of();
List mySingleElementList = com.google.common.collect.ImmutableList.of(1);

and so forth for the other collections. The one disadvantage is that it doesn&#039;t return the same list every time, so you have less memory efficiency, but IMO the consistency of usage outweights this.

Otherwise, good list!</description>
		<content:encoded><![CDATA[<p>If you&#8217;re not constrained to the Java Standard Library, I would prefer to use Google Collections &#8220;Immutable&#8221; collection objects, for empty collections or otherwise:</p>
<p>List myEmptyList = com.google.common.collect.ImmutableList.of();<br />
List mySingleElementList = com.google.common.collect.ImmutableList.of(1);</p>
<p>and so forth for the other collections. The one disadvantage is that it doesn&#8217;t return the same list every time, so you have less memory efficiency, but IMO the consistency of usage outweights this.</p>
<p>Otherwise, good list!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

