<?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 for Codemunchies</title>
	<atom:link href="http://codemunchies.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://codemunchies.com</link>
	<description>Satisfy your cravings</description>
	<lastBuildDate>Tue, 09 Mar 2010 05:20:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on Diving into the Google Guava library (part 2) by J.F. Zarama</title>
		<link>http://codemunchies.com/2009/10/diving-into-the-google-guava-library-part-2/comment-page-1/#comment-288</link>
		<dc:creator>J.F. Zarama</dc:creator>
		<pubDate>Tue, 09 Mar 2010 05:20:35 +0000</pubDate>
		<guid isPermaLink="false">http://codemunchies.com/?p=243#comment-288</guid>
		<description>Thanks for the Guava series; I find it a very useful to understand and use the library;</description>
		<content:encoded><![CDATA[<p>Thanks for the Guava series; I find it a very useful to understand and use the library;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Reduce development time with JRebel by Jevgeni Kabanov</title>
		<link>http://codemunchies.com/2010/02/reduce-development-time-with-jrebel/comment-page-1/#comment-281</link>
		<dc:creator>Jevgeni Kabanov</dc:creator>
		<pubDate>Thu, 25 Feb 2010 13:16:56 +0000</pubDate>
		<guid isPermaLink="false">http://codemunchies.com/?p=289#comment-281</guid>
		<description>Doesn&#039;t it work with GigaSpaces? Is there a reason it shouldn&#039;t?</description>
		<content:encoded><![CDATA[<p>Doesn&#8217;t it work with GigaSpaces? Is there a reason it shouldn&#8217;t?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Reduce development time with JRebel by Martin Harris</title>
		<link>http://codemunchies.com/2010/02/reduce-development-time-with-jrebel/comment-page-1/#comment-279</link>
		<dc:creator>Martin Harris</dc:creator>
		<pubDate>Wed, 24 Feb 2010 20:05:57 +0000</pubDate>
		<guid isPermaLink="false">http://codemunchies.com/?p=289#comment-279</guid>
		<description>I wish this would work with Gigaspaces.  Its spring based....so perhaps one day.</description>
		<content:encoded><![CDATA[<p>I wish this would work with Gigaspaces.  Its spring based&#8230;.so perhaps one day.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Functional Java, Filtering and Ordering with Google Collections (part 3) by Martin Harris</title>
		<link>http://codemunchies.com/2009/11/functional-java-filtering-and-ordering-with-google-collections-part-3/comment-page-1/#comment-274</link>
		<dc:creator>Martin Harris</dc:creator>
		<pubDate>Thu, 11 Feb 2010 11:01:55 +0000</pubDate>
		<guid isPermaLink="false">http://codemunchies.com/?p=245#comment-274</guid>
		<description>Love your posts, and the photography.  I have been posting similar stuff on my blog, but more problem / solution focused, and to be honest have not done as good a job as you due to time constraints.

Have you looked at the Spring 3 release and SPeL?  You can solve similar problems with that.  It overlaps, and covers different areas.  In fact if you look at what you can do with SPeL, Hamcrest and Guava the combined extra power is fantastic.

With SPeL you miss out on this ability to form an iterable backed by the original collection, but in some cases it can still be of use.  I think your example from above would look a bit like this.  Excuse any mistakes I am free coding this!

Iterable filtered = filter(names, or(or(equalTo(&quot;Aleksander&quot;),equalTo(&quot;Jaran&quot;)), lengthLessThan(5)));

List filtered = (List) parser.parseExpression(&quot;#names.?[(Name == &#039;Aleksander&#039; &#124;&#124; Name == &#039;Jaran&#039;) &amp;&amp; Name &lt; 5 ]&quot;).getValue(names);

Not as pretty by any means, but interesting all the same.

See for detail:
http://static.springsource.org/spring/docs/3.0.0.M3/spring-framework-reference/html/ch07s02.html</description>
		<content:encoded><![CDATA[<p>Love your posts, and the photography.  I have been posting similar stuff on my blog, but more problem / solution focused, and to be honest have not done as good a job as you due to time constraints.</p>
<p>Have you looked at the Spring 3 release and SPeL?  You can solve similar problems with that.  It overlaps, and covers different areas.  In fact if you look at what you can do with SPeL, Hamcrest and Guava the combined extra power is fantastic.</p>
<p>With SPeL you miss out on this ability to form an iterable backed by the original collection, but in some cases it can still be of use.  I think your example from above would look a bit like this.  Excuse any mistakes I am free coding this!</p>
<p>Iterable filtered = filter(names, or(or(equalTo(&#8220;Aleksander&#8221;),equalTo(&#8220;Jaran&#8221;)), lengthLessThan(5)));</p>
<p>List filtered = (List) parser.parseExpression(&#8220;#names.?[(Name == 'Aleksander' || Name == 'Jaran') &amp;&amp; Name &lt; 5 ]&quot;).getValue(names);</p>
<p>Not as pretty by any means, but interesting all the same.</p>
<p>See for detail:<br />
<a href="http://static.springsource.org/spring/docs/3.0.0.M3/spring-framework-reference/html/ch07s02.html" rel="nofollow">http://static.springsource.org/spring/docs/3.0.0.M3/spring-framework-reference/html/ch07s02.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Cast away with Java generics by John Harris</title>
		<link>http://codemunchies.com/2009/10/cast-away-with-java-generics/comment-page-1/#comment-272</link>
		<dc:creator>John Harris</dc:creator>
		<pubDate>Fri, 29 Jan 2010 18:54:06 +0000</pubDate>
		<guid isPermaLink="false">http://codemunchies.com/?p=175#comment-272</guid>
		<description>Surely this is missing the point of what the compiler is warning you about, your &#039;beautiful&#039; code is just moving the problem elsewhere.

Your original code has both an unchecked cast and an unchecked conversion. Seeing as neither are being checked you can write less code and get exactly the same bytecode by only coding the required cast i.e.:

Map&lt;String, Map&lt;String, Collection&gt;&gt; myUglyMap = (Map)webappSession.getAttribute(&quot;myUglyMap&quot;);

Which is the same length as your workaround without having to create an extra utility class and import it.

Now if you wanted to really address the problem you&#039;d need to define the parameterised type Map in a custom class, then perform a checked cast on the object from the session map.

Failing that you could iterate over the contents of the map (and nested map, and collection) checking their types. Without this you are doing an unchecked conversion and should rightly by warned by the compiler- if the cast passes you may still get class casts down the line as other code accesses the data in the Map.</description>
		<content:encoded><![CDATA[<p>Surely this is missing the point of what the compiler is warning you about, your &#8216;beautiful&#8217; code is just moving the problem elsewhere.</p>
<p>Your original code has both an unchecked cast and an unchecked conversion. Seeing as neither are being checked you can write less code and get exactly the same bytecode by only coding the required cast i.e.:</p>
<p>Map&lt;String, Map&lt;String, Collection&gt;&gt; myUglyMap = (Map)webappSession.getAttribute(&#8220;myUglyMap&#8221;);</p>
<p>Which is the same length as your workaround without having to create an extra utility class and import it.</p>
<p>Now if you wanted to really address the problem you&#8217;d need to define the parameterised type Map in a custom class, then perform a checked cast on the object from the session map.</p>
<p>Failing that you could iterate over the contents of the map (and nested map, and collection) checking their types. Without this you are doing an unchecked conversion and should rightly by warned by the compiler- if the cast passes you may still get class casts down the line as other code accesses the data in the Map.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Cast away with Java generics by Nanda Firdausi</title>
		<link>http://codemunchies.com/2009/10/cast-away-with-java-generics/comment-page-1/#comment-270</link>
		<dc:creator>Nanda Firdausi</dc:creator>
		<pubDate>Wed, 06 Jan 2010 20:47:29 +0000</pubDate>
		<guid isPermaLink="false">http://codemunchies.com/?p=175#comment-270</guid>
		<description>Thanks for the nice code and please check my suggestion to make it better here: http://satukubik.com/2010/01/06/java-tips-using-generic-correctly/</description>
		<content:encoded><![CDATA[<p>Thanks for the nice code and please check my suggestion to make it better here: <a href="http://satukubik.com/2010/01/06/java-tips-using-generic-correctly/" rel="nofollow">http://satukubik.com/2010/01/06/java-tips-using-generic-correctly/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Cast away with Java generics by Java Tips: Using generic correctly &#124; satukubik</title>
		<link>http://codemunchies.com/2009/10/cast-away-with-java-generics/comment-page-1/#comment-269</link>
		<dc:creator>Java Tips: Using generic correctly &#124; satukubik</dc:creator>
		<pubDate>Wed, 06 Jan 2010 20:34:38 +0000</pubDate>
		<guid isPermaLink="false">http://codemunchies.com/?p=175#comment-269</guid>
		<description>[...] The last article I refer on article Java Tips: Iterate and cast is one example where we write a Java code using generic but not optimally. The code is as follow: [...]</description>
		<content:encoded><![CDATA[<p>[...] The last article I refer on article Java Tips: Iterate and cast is one example where we write a Java code using generic but not optimally. The code is as follow: [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Cast away with Java generics by Java Tips: Iterate and cast &#124; satukubik</title>
		<link>http://codemunchies.com/2009/10/cast-away-with-java-generics/comment-page-1/#comment-268</link>
		<dc:creator>Java Tips: Iterate and cast &#124; satukubik</dc:creator>
		<pubDate>Tue, 05 Jan 2010 10:11:13 +0000</pubDate>
		<guid isPermaLink="false">http://codemunchies.com/?p=175#comment-268</guid>
		<description>[...] came across this idea after reading an article Cast away with Java generics. The article suggests a nice approach to [...]</description>
		<content:encoded><![CDATA[<p>[...] came across this idea after reading an article Cast away with Java generics. The article suggests a nice approach to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Beautiful code with Google Collections, Guava and static imports &#8211; Part 1! by xeon</title>
		<link>http://codemunchies.com/2009/10/beautiful-code-with-google-collections-guava-and-static-imports-part-1/comment-page-1/#comment-106</link>
		<dc:creator>xeon</dc:creator>
		<pubDate>Sat, 14 Nov 2009 12:58:58 +0000</pubDate>
		<guid isPermaLink="false">http://codemunchies.com/?p=105#comment-106</guid>
		<description>this is compliance RTSJ, so that i will not using this library.</description>
		<content:encoded><![CDATA[<p>this is compliance RTSJ, so that i will not using this library.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Preconditions, Multimaps and partitioning with Google Collections (part 4) by Computing Map on Google Collections &#124; satukubik</title>
		<link>http://codemunchies.com/2009/11/preconditions-multimaps-and-partitioning-with-google-collections-part-4/comment-page-1/#comment-105</link>
		<dc:creator>Computing Map on Google Collections &#124; satukubik</dc:creator>
		<pubDate>Fri, 13 Nov 2009 21:36:50 +0000</pubDate>
		<guid isPermaLink="false">http://codemunchies.com/?p=249#comment-105</guid>
		<description>[...] Preconditions, MultiMaps, and Partitioning with Google Collections [...]</description>
		<content:encoded><![CDATA[<p>[...] Preconditions, MultiMaps, and Partitioning with Google Collections [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
