<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Groovy vs. Google Collections: Round #1</title>
	<link>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/</link>
	<description>sweaty programming and disconnected gibberish</description>
	<pubDate>Sat, 05 Jul 2008 00:41:30 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2</generator>

	<item>
		<title>By: Tiago Albineli Motta</title>
		<link>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-9094</link>
		<author>Tiago Albineli Motta</author>
		<pubDate>Tue, 06 May 2008 14:43:06 +0000</pubDate>
		<guid>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-9094</guid>
		<description>It's Beatifull!</description>
		<content:encoded><![CDATA[<p>It&#8217;s Beatifull!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Taylor</title>
		<link>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8748</link>
		<author>Matthew Taylor</author>
		<pubDate>Sat, 19 Apr 2008 12:25:40 +0000</pubDate>
		<guid>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8748</guid>
		<description>One more neat thing about combinations that I didn't mention: You aren't restricted to two lists to combine.  It can be as many as you want:

&lt;div class="code"&gt;&lt;/pre&gt;def boys = ['Paco', 'Sven', 'Roger', 'Emelio']
def girls = ['Julia', 'Prudence', 'Lucy']
def locs = ['Milan', 'Prague', 'St. Louis', 'Toronto', 'Hong Kong', 'Los Angelos']

def combos = [boys, girls, locs].combinations()&lt;/pre&gt;&lt;/div&gt;

produces:

&lt;blockquote&gt;[["Paco", "Julia", "Milan"], ["Sven", "Julia", "Milan"], ["Roger", "Julia", "Milan"], ["Emelio", "Julia", "Milan"], ["Paco", "Prudence", "Milan"], ["Sven", "Prudence", "Milan"], ["Roger", "Prudence", "Milan"], ["Emelio", "Prudence", "Milan"], ["Paco", "Lucy", "Milan"], ["Sven", "Lucy", "Milan"], ["Roger", "Lucy", "Milan"], ["Emelio", "Lucy", "Milan"], ["Paco", "Julia", "Prague"], ["Sven", "Julia", "Prague"], ["Roger", "Julia", "Prague"], ["Emelio", "Julia", "Prague"], ["Paco", "Prudence", "Prague"], ["Sven", "Prudence", "Prague"], ["Roger", "Prudence", "Prague"], ["Emelio", "Prudence", "Prague"], ["Paco", "Lucy", "Prague"], ["Sven", "Lucy", "Prague"], ["Roger", "Lucy", "Prague"], ["Emelio", "Lucy", "Prague"], ["Paco", "Julia", "St. Louis"], ["Sven", "Julia", "St. Louis"], ["Roger", "Julia", "St. Louis"], ["Emelio", "Julia", "St. Louis"], ["Paco", "Prudence", "St. Louis"], ["Sven", "Prudence", "St. Louis"], ["Roger", "Prudence", "St. Louis"], ["Emelio", "Prudence", "St. Louis"], ["Paco", "Lucy", "St. Louis"], ["Sven", "Lucy", "St. Louis"], ["Roger", "Lucy", "St. Louis"], ["Emelio", "Lucy", "St. Louis"], ["Paco", "Julia", "Toronto"], ["Sven", "Julia", "Toronto"], ["Roger", "Julia", "Toronto"], ["Emelio", "Julia", "Toronto"], ["Paco", "Prudence", "Toronto"], ["Sven", "Prudence", "Toronto"], ["Roger", "Prudence", "Toronto"], ["Emelio", "Prudence", "Toronto"], ["Paco", "Lucy", "Toronto"], ["Sven", "Lucy", "Toronto"], ["Roger", "Lucy", "Toronto"], ["Emelio", "Lucy", "Toronto"], ["Paco", "Julia", "Hong Kong"], ["Sven", "Julia", "Hong Kong"], ["Roger", "Julia", "Hong Kong"], ["Emelio", "Julia", "Hong Kong"], ["Paco", "Prudence", "Hong Kong"], ["Sven", "Prudence", "Hong Kong"], ["Roger", "Prudence", "Hong Kong"], ["Emelio", "Prudence", "Hong Kong"], ["Paco", "Lucy", "Hong Kong"], ["Sven", "Lucy", "Hong Kong"], ["Roger", "Lucy", "Hong Kong"], ["Emelio", "Lucy", "Hong Kong"], ["Paco", "Julia", "Los Angelos"], ["Sven", "Julia", "Los Angelos"], ["Roger", "Julia", "Los Angelos"], ["Emelio", "Julia", "Los Angelos"], ["Paco", "Prudence", "Los Angelos"], ["Sven", "Prudence", "Los Angelos"], ["Roger", "Prudence", "Los Angelos"], ["Emelio", "Prudence", "Los Angelos"], ["Paco", "Lucy", "Los Angelos"], ["Sven", "Lucy", "Los Angelos"], ["Roger", "Lucy", "Los Angelos"], ["Emelio", "Lucy", "Los Angelos"]]&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<p>One more neat thing about combinations that I didn&#8217;t mention: You aren&#8217;t restricted to two lists to combine.  It can be as many as you want:</p>
<div class="code">def boys = [&#8217;Paco&#8217;, &#8216;Sven&#8217;, &#8216;Roger&#8217;, &#8216;Emelio&#8217;]<br />
def girls = [&#8217;Julia&#8217;, &#8216;Prudence&#8217;, &#8216;Lucy&#8217;]<br />
def locs = [&#8217;Milan&#8217;, &#8216;Prague&#8217;, &#8216;St. Louis&#8217;, &#8216;Toronto&#8217;, &#8216;Hong Kong&#8217;, &#8216;Los Angelos&#8217;]</p>
<p>def combos = [boys, girls, locs].combinations()</p></div>
<p>produces:</p>
<blockquote><p>[[&#8221;Paco&#8221;, &#8220;Julia&#8221;, &#8220;Milan&#8221;], [&#8221;Sven&#8221;, &#8220;Julia&#8221;, &#8220;Milan&#8221;], [&#8221;Roger&#8221;, &#8220;Julia&#8221;, &#8220;Milan&#8221;], [&#8221;Emelio&#8221;, &#8220;Julia&#8221;, &#8220;Milan&#8221;], [&#8221;Paco&#8221;, &#8220;Prudence&#8221;, &#8220;Milan&#8221;], [&#8221;Sven&#8221;, &#8220;Prudence&#8221;, &#8220;Milan&#8221;], [&#8221;Roger&#8221;, &#8220;Prudence&#8221;, &#8220;Milan&#8221;], [&#8221;Emelio&#8221;, &#8220;Prudence&#8221;, &#8220;Milan&#8221;], [&#8221;Paco&#8221;, &#8220;Lucy&#8221;, &#8220;Milan&#8221;], [&#8221;Sven&#8221;, &#8220;Lucy&#8221;, &#8220;Milan&#8221;], [&#8221;Roger&#8221;, &#8220;Lucy&#8221;, &#8220;Milan&#8221;], [&#8221;Emelio&#8221;, &#8220;Lucy&#8221;, &#8220;Milan&#8221;], [&#8221;Paco&#8221;, &#8220;Julia&#8221;, &#8220;Prague&#8221;], [&#8221;Sven&#8221;, &#8220;Julia&#8221;, &#8220;Prague&#8221;], [&#8221;Roger&#8221;, &#8220;Julia&#8221;, &#8220;Prague&#8221;], [&#8221;Emelio&#8221;, &#8220;Julia&#8221;, &#8220;Prague&#8221;], [&#8221;Paco&#8221;, &#8220;Prudence&#8221;, &#8220;Prague&#8221;], [&#8221;Sven&#8221;, &#8220;Prudence&#8221;, &#8220;Prague&#8221;], [&#8221;Roger&#8221;, &#8220;Prudence&#8221;, &#8220;Prague&#8221;], [&#8221;Emelio&#8221;, &#8220;Prudence&#8221;, &#8220;Prague&#8221;], [&#8221;Paco&#8221;, &#8220;Lucy&#8221;, &#8220;Prague&#8221;], [&#8221;Sven&#8221;, &#8220;Lucy&#8221;, &#8220;Prague&#8221;], [&#8221;Roger&#8221;, &#8220;Lucy&#8221;, &#8220;Prague&#8221;], [&#8221;Emelio&#8221;, &#8220;Lucy&#8221;, &#8220;Prague&#8221;], [&#8221;Paco&#8221;, &#8220;Julia&#8221;, &#8220;St. Louis&#8221;], [&#8221;Sven&#8221;, &#8220;Julia&#8221;, &#8220;St. Louis&#8221;], [&#8221;Roger&#8221;, &#8220;Julia&#8221;, &#8220;St. Louis&#8221;], [&#8221;Emelio&#8221;, &#8220;Julia&#8221;, &#8220;St. Louis&#8221;], [&#8221;Paco&#8221;, &#8220;Prudence&#8221;, &#8220;St. Louis&#8221;], [&#8221;Sven&#8221;, &#8220;Prudence&#8221;, &#8220;St. Louis&#8221;], [&#8221;Roger&#8221;, &#8220;Prudence&#8221;, &#8220;St. Louis&#8221;], [&#8221;Emelio&#8221;, &#8220;Prudence&#8221;, &#8220;St. Louis&#8221;], [&#8221;Paco&#8221;, &#8220;Lucy&#8221;, &#8220;St. Louis&#8221;], [&#8221;Sven&#8221;, &#8220;Lucy&#8221;, &#8220;St. Louis&#8221;], [&#8221;Roger&#8221;, &#8220;Lucy&#8221;, &#8220;St. Louis&#8221;], [&#8221;Emelio&#8221;, &#8220;Lucy&#8221;, &#8220;St. Louis&#8221;], [&#8221;Paco&#8221;, &#8220;Julia&#8221;, &#8220;Toronto&#8221;], [&#8221;Sven&#8221;, &#8220;Julia&#8221;, &#8220;Toronto&#8221;], [&#8221;Roger&#8221;, &#8220;Julia&#8221;, &#8220;Toronto&#8221;], [&#8221;Emelio&#8221;, &#8220;Julia&#8221;, &#8220;Toronto&#8221;], [&#8221;Paco&#8221;, &#8220;Prudence&#8221;, &#8220;Toronto&#8221;], [&#8221;Sven&#8221;, &#8220;Prudence&#8221;, &#8220;Toronto&#8221;], [&#8221;Roger&#8221;, &#8220;Prudence&#8221;, &#8220;Toronto&#8221;], [&#8221;Emelio&#8221;, &#8220;Prudence&#8221;, &#8220;Toronto&#8221;], [&#8221;Paco&#8221;, &#8220;Lucy&#8221;, &#8220;Toronto&#8221;], [&#8221;Sven&#8221;, &#8220;Lucy&#8221;, &#8220;Toronto&#8221;], [&#8221;Roger&#8221;, &#8220;Lucy&#8221;, &#8220;Toronto&#8221;], [&#8221;Emelio&#8221;, &#8220;Lucy&#8221;, &#8220;Toronto&#8221;], [&#8221;Paco&#8221;, &#8220;Julia&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Sven&#8221;, &#8220;Julia&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Roger&#8221;, &#8220;Julia&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Emelio&#8221;, &#8220;Julia&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Paco&#8221;, &#8220;Prudence&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Sven&#8221;, &#8220;Prudence&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Roger&#8221;, &#8220;Prudence&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Emelio&#8221;, &#8220;Prudence&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Paco&#8221;, &#8220;Lucy&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Sven&#8221;, &#8220;Lucy&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Roger&#8221;, &#8220;Lucy&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Emelio&#8221;, &#8220;Lucy&#8221;, &#8220;Hong Kong&#8221;], [&#8221;Paco&#8221;, &#8220;Julia&#8221;, &#8220;Los Angelos&#8221;], [&#8221;Sven&#8221;, &#8220;Julia&#8221;, &#8220;Los Angelos&#8221;], [&#8221;Roger&#8221;, &#8220;Julia&#8221;, &#8220;Los Angelos&#8221;], [&#8221;Emelio&#8221;, &#8220;Julia&#8221;, &#8220;Los Angelos&#8221;], [&#8221;Paco&#8221;, &#8220;Prudence&#8221;, &#8220;Los Angelos&#8221;], [&#8221;Sven&#8221;, &#8220;Prudence&#8221;, &#8220;Los Angelos&#8221;], [&#8221;Roger&#8221;, &#8220;Prudence&#8221;, &#8220;Los Angelos&#8221;], [&#8221;Emelio&#8221;, &#8220;Prudence&#8221;, &#8220;Los Angelos&#8221;], [&#8221;Paco&#8221;, &#8220;Lucy&#8221;, &#8220;Los Angelos&#8221;], [&#8221;Sven&#8221;, &#8220;Lucy&#8221;, &#8220;Los Angelos&#8221;], [&#8221;Roger&#8221;, &#8220;Lucy&#8221;, &#8220;Los Angelos&#8221;], [&#8221;Emelio&#8221;, &#8220;Lucy&#8221;, &#8220;Los Angelos&#8221;]]</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grails Podcast Episode 53 &#171; Sven Haiges&#8217; Personal Blog</title>
		<link>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8672</link>
		<author>Grails Podcast Episode 53 &#171; Sven Haiges&#8217; Personal Blog</author>
		<pubDate>Mon, 14 Apr 2008 17:46:46 +0000</pubDate>
		<guid>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8672</guid>
		<description>[...] vs Google Collections. Matt on Groovy. Dan on Google [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] vs Google Collections. Matt on Groovy. Dan on Google [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dangertree techblog &#187; Blog Archive &#187; Groovy vs. Google Collections: Round #2</title>
		<link>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8577</link>
		<author>dangertree techblog &#187; Blog Archive &#187; Groovy vs. Google Collections: Round #2</author>
		<pubDate>Wed, 09 Apr 2008 03:25:15 +0000</pubDate>
		<guid>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8577</guid>
		<description>[...] dangertree techblog sweaty programming and disconnected gibberish      &#171; Groovy vs. Google Collections: Round #1 [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] dangertree techblog sweaty programming and disconnected gibberish      &laquo; Groovy vs. Google Collections: Round #1 [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Klein</title>
		<link>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8532</link>
		<author>Dave Klein</author>
		<pubDate>Sat, 05 Apr 2008 15:18:33 +0000</pubDate>
		<guid>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8532</guid>
		<description>This is awesome.  I'm looking forward to round 2!</description>
		<content:encoded><![CDATA[<p>This is awesome.  I&#8217;m looking forward to round 2!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Taylor</title>
		<link>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8531</link>
		<author>Matthew Taylor</author>
		<pubDate>Sat, 05 Apr 2008 14:46:56 +0000</pubDate>
		<guid>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8531</guid>
		<description>In all fairness, the complete groovy code to print out the same as Dan's is here, and it is 12 lines:

&lt;div class="code"&gt;&lt;pre&gt;def boys = ['Paco', 'Sven', 'Roger', 'Emelio']
def girls = ['Julia', 'Prudence', 'Lucy']
def combos = [boys, girls].combinations()
println combos
def groupedByBoys = combos.groupBy { it[0] }
def groupedByGirls = combos.groupBy { it[1] }
groupedByBoys.each{ key, val -&gt;
    println "Partners of ${key}: ${val.collect{ it[1] }}"
}
groupedByGirls.each{ key, val -&gt;
    println "Partners of ${key}: ${val.collect{ it[0] }}"
}&lt;/pre&gt;&lt;/div&gt;

This prints out the following:
&lt;blockquote&gt;[["Paco", "Julia"], ["Sven", "Julia"], ["Roger", "Julia"], ["Emelio", "Julia"], ["Paco", "Prudence"], ["Sven", "Prudence"], ["Roger", "Prudence"], ["Emelio", "Prudence"], ["Paco", "Lucy"], ["Sven", "Lucy"], ["Roger", "Lucy"], ["Emelio", "Lucy"]]
Partners of Emelio: ["Julia", "Prudence", "Lucy"]
Partners of Roger: ["Julia", "Prudence", "Lucy"]
Partners of Sven: ["Julia", "Prudence", "Lucy"]
Partners of Paco: ["Julia", "Prudence", "Lucy"]
Partners of Lucy: ["Paco", "Sven", "Roger", "Emelio"]
Partners of Prudence: ["Paco", "Sven", "Roger", "Emelio"]
Partners of Julia: ["Paco", "Sven", "Roger", "Emelio"]&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<p>In all fairness, the complete groovy code to print out the same as Dan&#8217;s is here, and it is 12 lines:</p>
<div class="code">
<pre>def boys = ['Paco', 'Sven', 'Roger', 'Emelio']
def girls = ['Julia', 'Prudence', 'Lucy']
def combos = [boys, girls].combinations()
println combos
def groupedByBoys = combos.groupBy { it[0] }
def groupedByGirls = combos.groupBy { it[1] }
groupedByBoys.each{ key, val ->
    println "Partners of ${key}: ${val.collect{ it[1] }}"
}
groupedByGirls.each{ key, val ->
    println "Partners of ${key}: ${val.collect{ it[0] }}"
}</pre>
</div>
<p>This prints out the following:</p>
<blockquote><p>[[&#8221;Paco&#8221;, &#8220;Julia&#8221;], [&#8221;Sven&#8221;, &#8220;Julia&#8221;], [&#8221;Roger&#8221;, &#8220;Julia&#8221;], [&#8221;Emelio&#8221;, &#8220;Julia&#8221;], [&#8221;Paco&#8221;, &#8220;Prudence&#8221;], [&#8221;Sven&#8221;, &#8220;Prudence&#8221;], [&#8221;Roger&#8221;, &#8220;Prudence&#8221;], [&#8221;Emelio&#8221;, &#8220;Prudence&#8221;], [&#8221;Paco&#8221;, &#8220;Lucy&#8221;], [&#8221;Sven&#8221;, &#8220;Lucy&#8221;], [&#8221;Roger&#8221;, &#8220;Lucy&#8221;], [&#8221;Emelio&#8221;, &#8220;Lucy&#8221;]]<br />
Partners of Emelio: [&#8221;Julia&#8221;, &#8220;Prudence&#8221;, &#8220;Lucy&#8221;]<br />
Partners of Roger: [&#8221;Julia&#8221;, &#8220;Prudence&#8221;, &#8220;Lucy&#8221;]<br />
Partners of Sven: [&#8221;Julia&#8221;, &#8220;Prudence&#8221;, &#8220;Lucy&#8221;]<br />
Partners of Paco: [&#8221;Julia&#8221;, &#8220;Prudence&#8221;, &#8220;Lucy&#8221;]<br />
Partners of Lucy: [&#8221;Paco&#8221;, &#8220;Sven&#8221;, &#8220;Roger&#8221;, &#8220;Emelio&#8221;]<br />
Partners of Prudence: [&#8221;Paco&#8221;, &#8220;Sven&#8221;, &#8220;Roger&#8221;, &#8220;Emelio&#8221;]<br />
Partners of Julia: [&#8221;Paco&#8221;, &#8220;Sven&#8221;, &#8220;Roger&#8221;, &#8220;Emelio&#8221;]</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Lewis</title>
		<link>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8530</link>
		<author>Dan Lewis</author>
		<pubDate>Sat, 05 Apr 2008 13:41:02 +0000</pubDate>
		<guid>http://weblog.dangertree.net/2008/04/04/groovy-vs-google-collections-round-1/#comment-8530</guid>
		<description>I have posted a &lt;a href="http://observationandcomment.blogspot.com/2008/04/groovy-vs-google-collections-round-1.html" rel="nofollow"&gt;response&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>I have posted a <a href="http://observationandcomment.blogspot.com/2008/04/groovy-vs-google-collections-round-1.html" rel="nofollow">response</a>.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
