<?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: Google Collections</title>
	<atom:link href="http://blog.jayway.com/2009/10/22/google-collections/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jayway.com/2009/10/22/google-collections/</link>
	<description>Sharing Experience</description>
	<lastBuildDate>Thu, 11 Mar 2010 19:33:28 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: A Generic Method For Sorting (Google Collections) Multiset Per Entry Count &#171; Java. Internet. Algorithms. Ideas.</title>
		<link>http://blog.jayway.com/2009/10/22/google-collections/comment-page-1/#comment-26289</link>
		<dc:creator>A Generic Method For Sorting (Google Collections) Multiset Per Entry Count &#171; Java. Internet. Algorithms. Ideas.</dc:creator>
		<pubDate>Sat, 20 Feb 2010 17:47:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jayway.com/?p=2052#comment-26289</guid>
		<description>[...] used google collections, in addition to the official website, you might find those tutorials (1 and 2)  useful for an [...]</description>
		<content:encoded><![CDATA[<p>[...] used google collections, in addition to the official website, you might find those tutorials (1 and 2)  useful for an [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak</title>
		<link>http://blog.jayway.com/2009/10/22/google-collections/comment-page-1/#comment-25333</link>
		<dc:creator>Deepak</dc:creator>
		<pubDate>Tue, 16 Feb 2010 15:55:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jayway.com/?p=2052#comment-25333</guid>
		<description>Good stuff, I tried to explore basic aspects in this article - http://www.myhomepageindia.com/index.php/2010/01/07/google-collection-types.html</description>
		<content:encoded><![CDATA[<p>Good stuff, I tried to explore basic aspects in this article &#8211; <a href="http://www.myhomepageindia.com/index.php/2010/01/07/google-collection-types.html" rel="nofollow">http://www.myhomepageindia.com/index.php/2010/01/07/google-collection-types.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger Schildmeijer</title>
		<link>http://blog.jayway.com/2009/10/22/google-collections/comment-page-1/#comment-14422</link>
		<dc:creator>Roger Schildmeijer</dc:creator>
		<pubDate>Tue, 27 Oct 2009 20:12:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jayway.com/?p=2052#comment-14422</guid>
		<description>http://code.google.com/p/guava-libraries/</description>
		<content:encoded><![CDATA[<p><a href="http://code.google.com/p/guava-libraries/" rel="nofollow">http://code.google.com/p/guava-libraries/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sune Simonsen</title>
		<link>http://blog.jayway.com/2009/10/22/google-collections/comment-page-1/#comment-14312</link>
		<dc:creator>Sune Simonsen</dc:creator>
		<pubDate>Mon, 26 Oct 2009 09:11:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jayway.com/?p=2052#comment-14312</guid>
		<description>Thanks to all of you, I&#039;m really happy you liked the article.

To you Phil, I can&#039;t come up with a better way than to sort by occurrences as you mentioned:

Function&lt;Multiset.Entry&lt;Fruit&gt;, Integer&gt; getCountFunction =
&#160;&#160;&#160;&#160;new Function&lt;Multiset.Entry&lt;Fruit&gt;, Integer&gt;() {
&#160;&#160;&#160;&#160;&#160;&#160;public Integer apply(Multiset.Entry&lt;Fruit&gt; from) {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return from.getCount();
&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;};

Ordering&lt;Multiset.Entry&lt;Fruit&gt;&gt; popular =
&#160;&#160;&#160;&#160;Ordering.natural().reverse().onResultOf(getCountFunction);

List&lt;Multiset.Entry&lt;Fruit&gt;&gt; sorted =
&#160;&#160;&#160;&#160;popular.sortedCopy(fruits.entrySet());

for (Multiset.Entry&lt;Fruit&gt; entry : sorted) {
&#160;&#160;System.out.println(String.format(&quot;%s %s&quot;, entry.getCount(),
&#160;&#160;&#160;&#160;entry.getElement()));
}

4: Yellow Banana
3: Red Strawberry
2: Green Kiwifruit
2: Red Tomato
1: Yellow Lemon</description>
		<content:encoded><![CDATA[<p>Thanks to all of you, I&#8217;m really happy you liked the article.</p>
<p>To you Phil, I can&#8217;t come up with a better way than to sort by occurrences as you mentioned:</p>
<p>Function&lt;Multiset.Entry&lt;Fruit&gt;, Integer&gt; getCountFunction =<br />
&nbsp;&nbsp;&nbsp;&nbsp;new Function&lt;Multiset.Entry&lt;Fruit&gt;, Integer&gt;() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public Integer apply(Multiset.Entry&lt;Fruit&gt; from) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return from.getCount();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;};</p>
<p>Ordering&lt;Multiset.Entry&lt;Fruit&gt;&gt; popular =<br />
&nbsp;&nbsp;&nbsp;&nbsp;Ordering.natural().reverse().onResultOf(getCountFunction);</p>
<p>List&lt;Multiset.Entry&lt;Fruit&gt;&gt; sorted =<br />
&nbsp;&nbsp;&nbsp;&nbsp;popular.sortedCopy(fruits.entrySet());</p>
<p>for (Multiset.Entry&lt;Fruit&gt; entry : sorted) {<br />
&nbsp;&nbsp;System.out.println(String.format(&#8220;%s %s&#8221;, entry.getCount(),<br />
&nbsp;&nbsp;&nbsp;&nbsp;entry.getElement()));<br />
}</p>
<p>4: Yellow Banana<br />
3: Red Strawberry<br />
2: Green Kiwifruit<br />
2: Red Tomato<br />
1: Yellow Lemon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phil</title>
		<link>http://blog.jayway.com/2009/10/22/google-collections/comment-page-1/#comment-14291</link>
		<dc:creator>phil</dc:creator>
		<pubDate>Sun, 25 Oct 2009 21:26:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jayway.com/?p=2052#comment-14291</guid>
		<description>As you guessed, I meant &quot;multiset&quot; and not multimap in my example.
Thanks.</description>
		<content:encoded><![CDATA[<p>As you guessed, I meant &#8220;multiset&#8221; and not multimap in my example.<br />
Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phil</title>
		<link>http://blog.jayway.com/2009/10/22/google-collections/comment-page-1/#comment-14290</link>
		<dc:creator>phil</dc:creator>
		<pubDate>Sun, 25 Oct 2009 21:24:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jayway.com/?p=2052#comment-14290</guid>
		<description>Excellent post!
I have a question. Do you know a way to sort a multiset based on the number of occurrence of each elements? 
For instance if your multimap is
apple -&gt; 1
tomato -&gt;5
you would like to see tomato first.
I can&#039;t find an easy way to do that operation that seems to me very usefull.
In the meantime I used a comparator as follow

Comparator&lt;Multiset.Entry&gt; occurence_comparator = new Comparator&lt;Multiset.Entry&gt;() {
			public int compare(Multiset.Entry e1, Multiset.Entry e2) {
				return e2.getCount() - e1.getCount() ;
			}
		};
		
Is there a more generic and elegant way to do it?
Thanks!
-Phil.</description>
		<content:encoded><![CDATA[<p>Excellent post!<br />
I have a question. Do you know a way to sort a multiset based on the number of occurrence of each elements?<br />
For instance if your multimap is<br />
apple -&gt; 1<br />
tomato -&gt;5<br />
you would like to see tomato first.<br />
I can&#8217;t find an easy way to do that operation that seems to me very usefull.<br />
In the meantime I used a comparator as follow</p>
<p>Comparator&lt;Multiset.Entry&gt; occurence_comparator = new Comparator&lt;Multiset.Entry&gt;() {<br />
			public int compare(Multiset.Entry e1, Multiset.Entry e2) {<br />
				return e2.getCount() &#8211; e1.getCount() ;<br />
			}<br />
		};</p>
<p>Is there a more generic and elegant way to do it?<br />
Thanks!<br />
-Phil.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sachin Misurkar</title>
		<link>http://blog.jayway.com/2009/10/22/google-collections/comment-page-1/#comment-14216</link>
		<dc:creator>sachin Misurkar</dc:creator>
		<pubDate>Sat, 24 Oct 2009 15:34:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jayway.com/?p=2052#comment-14216</guid>
		<description>Thanks for sharing such new and useful info.</description>
		<content:encoded><![CDATA[<p>Thanks for sharing such new and useful info.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anshu Mishra</title>
		<link>http://blog.jayway.com/2009/10/22/google-collections/comment-page-1/#comment-14178</link>
		<dc:creator>Anshu Mishra</dc:creator>
		<pubDate>Fri, 23 Oct 2009 20:06:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jayway.com/?p=2052#comment-14178</guid>
		<description>Thanks for the post. I was planning to explore it since the first time I saw it presented by Bob Lee and Josh Bloch. Good work !

Nice introduction.</description>
		<content:encoded><![CDATA[<p>Thanks for the post. I was planning to explore it since the first time I saw it presented by Bob Lee and Josh Bloch. Good work !</p>
<p>Nice introduction.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin Winterberg</title>
		<link>http://blog.jayway.com/2009/10/22/google-collections/comment-page-1/#comment-14158</link>
		<dc:creator>Benjamin Winterberg</dc:creator>
		<pubDate>Fri, 23 Oct 2009 08:36:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jayway.com/?p=2052#comment-14158</guid>
		<description>This is a nice addition to this introduction to google collections:
http://bwinterberg.blogspot.com/2009/09/introduction-to-google-collections.html</description>
		<content:encoded><![CDATA[<p>This is a nice addition to this introduction to google collections:<br />
<a href="http://bwinterberg.blogspot.com/2009/09/introduction-to-google-collections.html" rel="nofollow">http://bwinterberg.blogspot.com/2009/09/introduction-to-google-collections.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Krzysztof Białek</title>
		<link>http://blog.jayway.com/2009/10/22/google-collections/comment-page-1/#comment-14157</link>
		<dc:creator>Krzysztof Białek</dc:creator>
		<pubDate>Fri, 23 Oct 2009 08:36:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jayway.com/?p=2052#comment-14157</guid>
		<description>Very nice introduction. It seems to be inspired by Scala collections a lot. It&#039;s a pity that functions definitions need so much boilerplate in Java. Thanks a lot.</description>
		<content:encoded><![CDATA[<p>Very nice introduction. It seems to be inspired by Scala collections a lot. It&#8217;s a pity that functions definitions need so much boilerplate in Java. Thanks a lot.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
