<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Transient Technology &#187; collections</title>
	<atom:link href="http://martinaharris.com/tag/collections/feed/" rel="self" type="application/rss+xml" />
	<link>http://martinaharris.com</link>
	<description>Next time you look it might be gone</description>
	<lastBuildDate>Wed, 25 Apr 2012 09:52:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>The power of XMLUnit with google Predicate</title>
		<link>http://martinaharris.com/2010/12/the-power-of-xmlunit-with-google-predicate/</link>
		<comments>http://martinaharris.com/2010/12/the-power-of-xmlunit-with-google-predicate/#comments</comments>
		<pubDate>Tue, 14 Dec 2010 22:46:19 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[predicate]]></category>
		<category><![CDATA[XMLUnit]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=1069</guid>
		<description><![CDATA[I have been interested in XMLUnit and google collections predicate system for awhile now and recently wrote the following as part of a test.  I have removed some of the test and left just the bits that illustrate this point. The test needs &#8230; <a href="http://martinaharris.com/2010/12/the-power-of-xmlunit-with-google-predicate/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have been interested in <a title="XMLUnit on sourceforge" href="http://xmlunit.sourceforge.net/" target="_blank">XMLUnit</a> and <a title="Google Collections" href="http://code.google.com/p/google-collections/" target="_blank">google collections</a> predicate system for awhile now and recently wrote the following as part of a test.  I have removed some of the test and left just the bits that illustrate this point.</p>
<p>The test needs to perform a check that the result of transforming some xml is correct.  A reference file is available so we can use XMLUnit to perform a difference.  In my file there is a seconds attribute and because seconds vary with each parse we choose to ignore the value.  There are other ways to achieve this, but its more complex and uses more XMLUnit code. Using a google predicate simplifies this check.</p>
<p>First produce your output file and load the sample and output into strings.  Normally for a test I produce a smaller sample xml file.  Then using XMLUnit difference engine get all differences.</p>
<pre class="brush: java; gutter: false; wrap-lines: false">    Diff d = new Diff(expectedAsString, outputAsString);
    DetailedDiff dd = new DetailedDiff(d);
    List listOfDifferences = dd.getAllDifferences();
</pre>
<p>Next call a function to check that the only differences found are within the seconds attribute.  This uses a predicates from google to perform the matching.</p>
<pre class="brush: java; gutter: false; wrap-lines: false">
    assertTrue(onlyDiffsMatchThisAttributeName("seconds",listOfDifferences));
    }

    private static boolean onlyDiffsMatchThisAttributeName(final String attrName, Iterable it) {

    Iterable filtered = Iterables.filter(it, new Predicate() {

        @Override
        public boolean apply(Difference input) {

                final NodeDetail testNodeDetail = input.getTestNodeDetail();
                if (nodeDetail == null) return false;

                final Node node = nodeDetail.getNode();
                if (node == null) return false;

                final String nodeName = node.getNodeName();
                if (nodeName == null) return false;

                return !nodeName.equals(attrName);
            }
        });
        return (newArrayList(filtered).isEmpty());
    }</pre>
<p>Note that what is happening here is the predicate is filtering away all the seconds matches.  If anything remains in the list false is returned.  Neat huh!  <img src='http://martinaharris.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F&amp;title=The+power+of+XMLUnit+with+google+Predicate" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F&amp;title=The+power+of+XMLUnit+with+google+Predicate" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F&amp;title=The+power+of+XMLUnit+with+google+Predicate" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F&amp;headline=The+power+of+XMLUnit+with+google+Predicate" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=The+power+of+XMLUnit+with+google+Predicate&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=The+power+of+XMLUnit+with+google+Predicate&amp;u=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=The+power+of+XMLUnit+with+google+Predicate&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=The+power+of+XMLUnit+with+google+Predicate&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=The+power+of+XMLUnit+with+google+Predicate&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F&amp;title=The+power+of+XMLUnit+with+google+Predicate&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F12%2Fthe-power-of-xmlunit-with-google-predicate%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2010/12/the-power-of-xmlunit-with-google-predicate/';
var dzone_title = 'The power of XMLUnit with google Predicate';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2010/12/the-power-of-xmlunit-with-google-predicate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hamcrest Collection Matching with Junit 4.8</title>
		<link>http://martinaharris.com/2010/04/hamcrest-collection-matching-with-junit-4-8/</link>
		<comments>http://martinaharris.com/2010/04/hamcrest-collection-matching-with-junit-4-8/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 22:46:09 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[hamcrest]]></category>
		<category><![CDATA[matcher]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=989</guid>
		<description><![CDATA[Sometime back I wrote about some testing anti-patterns.  Recently I came back to the project and made some trivial changes.  I fixed a bug upgraded spring and junit and migrated the test assertions to hamcrest fluid style.  The full project &#8230; <a href="http://martinaharris.com/2010/04/hamcrest-collection-matching-with-junit-4-8/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometime back I wrote about some testing <a title="Test Anti Patterns" href="/2009/11/anti-patterns-testing/" target="_blank">anti-patterns</a>.  Recently I came back to the project and made some trivial changes.  I fixed a bug upgraded spring and junit and migrated the test assertions to hamcrest fluid style.  The full project is <a title="GitHub Project" href="http://github.com/mhgit/TerribleJavaTestingMadeGood" target="_blank">available on git</a>.</p>
<p>I find hamcrest to be a much cleaner way of writing assertions.  This test demonstrates the use of its fluid interface with some simple collection assertions.  There are newer versions of Hamcrest and the collection package may have moved into core, but the version I use here (1.0) was available on maven.  Note the integration with Junit.  The <strong>hasItem</strong> and <strong>hasItems</strong> methods are sourced from <strong>Junit 4.8.1</strong>.</p>
<pre class="brush: java; gutter: false; wrap-lines: false">package org.testpatterns.hamcrestexamples;

import java.util.Arrays;
import org.junit.Test;
import static org.hamcrest.collection.IsArrayContaining.hasItemInArray;
import static org.junit.matchers.JUnitMatchers.*;
import static org.junit.Assert.assertThat;

public class CollectionExamples {

  //Hamcrest with Collections and Arrays:
  static final String[] array = { "A", "B", "C" };
  static final List&lt;String&gt; list = Arrays.asList(array);

  @Test
  public void oneThingInArray () {
    assertThat(array, hasItemInArray("A"));
  }

  @Test
  public void arrayOfItemsInList () {
  String[] expected = { "A", "B", "C" };
    assertThat(list, hasItems(expected));
  }

  @Test
  public void itemInAList () {
    assertThat(list, hasItem("A"));
  }

  @Test
  public void itemsInAList () {
    assertThat(list, hasItems("A", "C"));
  }

}
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F&amp;title=Hamcrest+Collection+Matching+with+Junit+4.8" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F&amp;title=Hamcrest+Collection+Matching+with+Junit+4.8" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F&amp;title=Hamcrest+Collection+Matching+with+Junit+4.8" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F&amp;headline=Hamcrest+Collection+Matching+with+Junit+4.8" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Hamcrest+Collection+Matching+with+Junit+4.8&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Hamcrest+Collection+Matching+with+Junit+4.8&amp;u=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Hamcrest+Collection+Matching+with+Junit+4.8&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Hamcrest+Collection+Matching+with+Junit+4.8&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Hamcrest+Collection+Matching+with+Junit+4.8&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F&amp;title=Hamcrest+Collection+Matching+with+Junit+4.8&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2010%2F04%2Fhamcrest-collection-matching-with-junit-4-8%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2010/04/hamcrest-collection-matching-with-junit-4-8/';
var dzone_title = 'Hamcrest Collection Matching with Junit 4.8';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2010/04/hamcrest-collection-matching-with-junit-4-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When you can&#8217;t avoid an out parameter</title>
		<link>http://martinaharris.com/2009/12/out-parameter/</link>
		<comments>http://martinaharris.com/2009/12/out-parameter/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 05:00:05 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[software quality]]></category>
		<category><![CDATA[builder]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[immutable]]></category>
		<category><![CDATA[parameter]]></category>
		<category><![CDATA[quality]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=473</guid>
		<description><![CDATA[We all know its a good idea to avoid using out variables in Java. In almost every case the code can be split up to avoid the situation. Its bad semantics because when reading the code its not obvious which &#8230; <a href="http://martinaharris.com/2009/12/out-parameter/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We all know its a good idea to avoid using <em>out</em> variables in Java.  In almost every case the code can be split up to avoid the situation.  Its bad semantics because when reading the code its not obvious which object passed, if any will get mutated.  So the reader is forced to open the method to find out what it does. In <a title="Clean Code Book Reference" href="http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1259702833&amp;sr=1-1" target="_blank">Robert C Martin&#8217;s Clean Code Book</a> he calls this forcing a double take, and suggests some ways to avoid the problem.  Rarely you find a case where you can&#8217;t avoid it, or to be more accurate, avoiding it leads to worse problems.</p>
<p>Take a look at this interface.  If I find this populate method, I am likely to have to open implementations.  I don&#8217;t know if it populates one map from the other or both maps.</p>
<pre class="brush: java; gutter: false; wrap-lines: true">import java.util.Map;

public interface NastyPopulator {

void populate(Map&lt;String, String&gt; driver, Map&lt;String, String&gt; driverHolder);

}</pre>
<p>The problem is the semantics of map are that you can read from maps or you can write to them.  I think this is a slightly better approach below.</p>
<p>I have used ImmutableMap.Builder.  The semantics of this are that it is used to build things.  I will call build() on the object later to get a map.  Next its an ImmutableMap.  So not only am I declaring that the two parameters are likely to be used to build something, that thing will ultimately be Immutable so in effect the signature declares that I am not expected to make modifications later.  Finally the method name is unambiguous buildMaps, which pretty much says what its going to do.</p>
<pre class="brush: java; gutter: false; wrap-lines: true">import com.google.common.collect.ImmutableMap;

public interface LessNastyPopulator {

void buildMaps(ImmutableMap.Builder&lt;String, String&gt;  driver, ImmutableMap.Builder&lt;String, String&gt; driverHolder);

}</pre>
<p>Feels like a stronger declaration to me.  If ImmutableMap is awkward you could define your own static builder and pass that in, at least your still declaring up front, that this method is  builds the two maps.  If the method is reading from one map and building others, how about passing an iterator and a builder?</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F&amp;title=When+you+can%27t+avoid+an+out+parameter+" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F&amp;title=When+you+can%27t+avoid+an+out+parameter+" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F&amp;title=When+you+can%27t+avoid+an+out+parameter+" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F&amp;headline=When+you+can%27t+avoid+an+out+parameter+" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=When+you+can%27t+avoid+an+out+parameter+&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=When+you+can%27t+avoid+an+out+parameter+&amp;u=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=When+you+can%27t+avoid+an+out+parameter+&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=When+you+can%27t+avoid+an+out+parameter+&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=When+you+can%27t+avoid+an+out+parameter+&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F&amp;title=When+you+can%27t+avoid+an+out+parameter+&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F12%2Fout-parameter%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2009/12/out-parameter/';
var dzone_title = 'When you can&#8217;t avoid an out parameter';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2009/12/out-parameter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Neat multiset in google collections API</title>
		<link>http://martinaharris.com/2009/10/neat-multiset-in-google-collections-api/</link>
		<comments>http://martinaharris.com/2009/10/neat-multiset-in-google-collections-api/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 00:14:27 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[software quality]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[equals]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[quality]]></category>
		<category><![CDATA[thread]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=113</guid>
		<description><![CDATA[This good thing was so small that I almost did not bother to blog it But the devil is in the detail so here it is anyway. I have this multi threaded application. One of the problems with integration testing &#8230; <a href="http://martinaharris.com/2009/10/neat-multiset-in-google-collections-api/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h3>This good thing was so small that I almost did not bother to blog it</h3>
<p><cite>But the devil is in the detail</cite> so here it is anyway.</p>
<p>I have this multi threaded application.  One of the problems with integration testing it is, you can&#8217;t guarantee the order that messages will be written to a stream.  So during the test I have to go to some trouble to split and order the lines written out.  If I don&#8217;t do this the test fails sometimes. It depends on which thread writes first. The output though is correct, order is not important.  Not exactly rocket science.</p>
<p>Here is the method I was using to massage the string.</p>
<pre class="brush: java; gutter: false; wrap-lines: false">
 public List&lt;String&gt; getSortedLines(String expectedString) {

        String[] splitExpectedResultLines = expectedString.toString().split("\n");
        List&lt;String&gt; resultLines = new ArrayList&lt;String&gt;();
        for (String messageLine : resultLines) {
            resultLines.add(messageLine);
        }

        Collections.sort(resultLines);
        return resultLines;
    }
</pre>
<p>There is nothing particularly wrong with the method.  It takes a string, splits it into lines, loads a List, sorts and returns it.  Thus when its used in an assertion later the expected and actual lists are the same.</p>
<p>With google collections its just three lines!  The HashMultiset is designed to be used in equals methods.  Its equal even if the order of the elements in collections being compared is different.  From the API documentation: <cite>An extension of Collection that may contain duplicate values like a List, yet has order-independent equality like a Set. One typical use for a multiset is to represent a histogram.</cite> </p>
<p>Its possible to use the HashMultiSet.create static factory method, passing in an Iterable.  i.e a Collection.  So from the original code, both the loop and the Collections.sort are no longer required.</p>
<pre class="brush: java; gutter: false; wrap-lines: false; highlight: 6">
   public HashMultiset&lt;String&gt; getOrderAgnosticCollection(String expectedString) {

        String[] splitExpectedResultLines = expectedString.toString().split("\n");
        Iterable&lt;String&gt; resultLines = Arrays.asList(splitExpectedResultLines);
        HashMultiset&lt;String&gt; orderAgnosticResultLines =
                                              HashMultiset.create(resultLines);

        return orderAgnosticResultLines;
    }
</pre>
<p>If there was something that performed the split, but returned an Iterable the method would be perfect!  <img src='http://martinaharris.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F&amp;title=Neat+multiset+in+google+collections+API" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F&amp;title=Neat+multiset+in+google+collections+API" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F&amp;title=Neat+multiset+in+google+collections+API" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F&amp;headline=Neat+multiset+in+google+collections+API" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Neat+multiset+in+google+collections+API&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Neat+multiset+in+google+collections+API&amp;u=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Neat+multiset+in+google+collections+API&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Neat+multiset+in+google+collections+API&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Neat+multiset+in+google+collections+API&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F&amp;title=Neat+multiset+in+google+collections+API&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fneat-multiset-in-google-collections-api%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2009/10/neat-multiset-in-google-collections-api/';
var dzone_title = 'Neat multiset in google collections API';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2009/10/neat-multiset-in-google-collections-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Refactoring to Google Collections &#8211; ImmutableList  for simple code</title>
		<link>http://martinaharris.com/2009/10/google-collection-refactor-simplifies-implementation/</link>
		<comments>http://martinaharris.com/2009/10/google-collection-refactor-simplifies-implementation/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 14:37:13 +0000</pubDate>
		<dc:creator>Martin Harris</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[immutable]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[thread]]></category>

		<guid isPermaLink="false">http://martinaharris.com/?p=54</guid>
		<description><![CDATA[Google collections are excellent in multi-threaded applications, so I thought I would re-factor some code to use them. <a href="http://martinaharris.com/2009/10/google-collection-refactor-simplifies-implementation/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was reading this excellent post on <a href="http://blog.jayway.com/2009/10/22/google-collections/" target="_blank">google collections by Sune Simonsen</a> and decided to re-factor some code of mine.  I have an immutable results object used in a multi-threaded application.  I wanted to feel the difference using the google ImmutableList.  My existing class provides immutability in a very similar way to the google classes.  Static methods are used to instantiate the object.  An array is used to back a list collection.  Defensive copies are made to protect the immutability of the object.  Moving to <a href="http://code.google.com/p/google-collections/" target="_blank">google collections</a> is easy and makes my implementation simple whilst reducing test overhead.</p>
<p><span id="more-54"></span></p>
<h3>Steps taken to refactor</h3>
<p>There was actually very little to do.</p>
<p><strong>Step 1, add a maven dependency</strong></p>
<pre class="brush: xml; gutter: false">
<dependency>
            <groupId>com.google.collections</groupId>
            <artifactId>google-collections</artifactId>
            <version>1.0-rc3</version>
            <type>jar</type>
</dependency>
</pre>
<p><strong>Step 2, replace the array with an ImmutableList</strong></p>
<pre class="brush: java; light: true">
private static final LineResult[] EMPTY_LINERESULT_ARRAY = new LineResult[0];
private LineResult[] lineResults = EMPTY_LINERESULT_ARRAY;
</pre>
<p>could become:</p>
<pre class="brush: java; light: true">
private List&lt;LineResult&gt;  lineResults = ImmutableList.of();
</pre>
<p>In the end I used ImmutableList to clearly my intent.  The usage is internal to the class so there is no advantage in using the List interface.</p>
<pre class="brush: java; light: true">
private ImmutableListst&lt;LineResult&gt;  lineResults = ImmutableList.of();
</pre>
<p><strong>Step 3, The constructor and static factory methods are simplified</strong><br />
We are no longer using an array to back the list, so the protective copy can be moved from the constructor into the static method.  This reduces the window of vulnerability you are exposed to before capturing the data held in the list.  This is a direct result of the google class providing a static factory method.  Nb.  Its a shame that the standard collections don&#8217;t provide static factory methods.</p>
<p>Prior to the changes the protective copy was done in construction like this.</p>
<pre class="brush: java; light: true">
 this.lineResults = lineResults.toArray(EMPTY_LINERESULT_ARRAY);
</pre>
<p>This result is a much simpler constructor.</p>
<pre class="brush: java; light: true; highlight: 3">
private ResultsFileSearch(File fileFound, ImmutableList&lt;LineResult&gt; lineResults) {
        this(fileFound);
        this.lineResults = lineResults;
}
</pre>
<p>My newInstance method makes use of the ImmutableList.copyOf static factory method resulting in a very clean conversion of List into Immutable list.  Note that generics is inferring the type.</p>
<pre class="brush: java; light: true; highlight: 4">
public static ResultsFileSearch newInstance(File fileFound
                 , List&lt;LineResult&gt; lineResults) {
        return new ResultsFileSearch(fileFound
                        ,ImmutableList.copyOf(lineResults));
}
</pre>
<p><strong>Step 4, the getLineResults method no longer has to deal with the array or conversion.</strong><br />
The original array backed object had to deal with returning either an empty list or conversion to an unmodifiable list.  There are two things I did not like about this when I wrote the original.</p>
<ul>
<li>The code has to check the array resulting in some conditional logic.  This increases the test overhead slightly.</li>
<li>The use of Collections.unmodifiableList(Arrays.asList(lineResults)); is very ugly and slow.</li>
</ul>
<p>This was the original, <em>note the subtle bug when returning an empty list</em>.</p>
<pre class="brush: java; light: true">
 public List&lt;LineResult&gt; getLineResults() {

        if ((this.lineResults.length == 0)) {
            return Collections.emptyList();
        } else {
            return Collections.unmodifiableList(Arrays.asList(lineResults));
        }
        return this.lineResults;
}
</pre>
<p>I hope you agree its a much simpler version using the google code.  As we are now using the Immutable implementation, we don&#8217;t have to worry about exposing the reference.</p>
<pre class="brush: java; light: true">
public List&lt;LineResult&gt; getLineResults() {
        return this.lineResults;
}
</pre>
<h3>Conclusions</h3>
<p>Using the google collections makes my implementation much cleaner.  Several complexities are given over to the google collections classes.  Moreover testing of my class is simpler.  The changes are contained within the class.  None of the method signatures change, which has two consequences.  On the plus side the re-factor is contained within this class.  On the negative side, any code modifying the list will raise an UnsupportedOperationException which was no different to my original version.  The construction of my class might be slightly slower, the memory overhead slightly bigger now that we are not using the array.  Counter to this, the getLineResults method is quicker as it now only returns a reference.  In my program this is more important as architecturally it uses bounded queues to hold these objects for processing by threads.  So although its using a little extra memory, its constrained.  The performance gain is worth it.</p>
<p>I recommend using the com.google.common.collect package but adhere to the <a href="http://code.google.com/p/google-collections/wiki/Faq" target="_blank">caveats</a> i.e don&#8217;t expose the types in an API etc.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F&amp;title=Refactoring+to+Google+Collections+-+ImmutableList++for+simple+code" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F&amp;title=Refactoring+to+Google+Collections+-+ImmutableList++for+simple+code" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F&amp;title=Refactoring+to+Google+Collections+-+ImmutableList++for+simple+code" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F&amp;headline=Refactoring+to+Google+Collections+-+ImmutableList++for+simple+code" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Refactoring+to+Google+Collections+-+ImmutableList++for+simple+code&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Refactoring+to+Google+Collections+-+ImmutableList++for+simple+code&amp;u=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Refactoring+to+Google+Collections+-+ImmutableList++for+simple+code&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Refactoring+to+Google+Collections+-+ImmutableList++for+simple+code&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Refactoring+to+Google+Collections+-+ImmutableList++for+simple+code&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F&amp;title=Refactoring+to+Google+Collections+-+ImmutableList++for+simple+code&amp;summary=&amp;source=" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fmartinaharris.com%2F2009%2F10%2Fgoogle-collection-refactor-simplifies-implementation%2F" target="_blank"><img class="lightsocial_img" src="http://martinaharris.com/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div><div class="dzone_button" style="float: right; margin-left: 5px;">
<script type="text/javascript">
var dzone_url = 'http://martinaharris.com/2009/10/google-collection-refactor-simplifies-implementation/';
var dzone_title = 'Refactoring to Google Collections &#8211; ImmutableList  for simple code';
var dzone_blurb = '';
var dzone_style = '2';
</script>
<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script>
</div>]]></content:encoded>
			<wfw:commentRss>http://martinaharris.com/2009/10/google-collection-refactor-simplifies-implementation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

