Refactoring to Google Collections – ImmutableList for simple code

I was reading this excellent post on google collections by Sune Simonsen 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 google collections is easy and makes my implementation simple whilst reducing test overhead.

Continue reading

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)