<?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>Alice and Bob in Cryptoland &#187; java</title>
	<atom:link href="http://alicebob.cryptoland.net/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://alicebob.cryptoland.net</link>
	<description></description>
	<lastBuildDate>Mon, 14 Feb 2011 13:29:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Yet another silly Python vs Java comparison</title>
		<link>http://alicebob.cryptoland.net/yet-another-silly-python-vs-java-comparison/</link>
		<comments>http://alicebob.cryptoland.net/yet-another-silly-python-vs-java-comparison/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 19:19:27 +0000</pubDate>
		<dc:creator>Conrado</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://alicebob.cryptoland.net/?p=172</guid>
		<description><![CDATA[I&#8217;ve been hacking the mspsim (a simulator) source to add support for a couple of stuffs in its profiler. At a certain point I had a hash table mapping functions to how many times they were called, and I had to sort them by that number of times. How to do that? List&#60;entry&#62; list = [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been hacking the mspsim (a simulator) source to add support for a couple of stuffs in its profiler. At a certain point I had a hash table mapping functions to how many times they were called, and I had to sort them by that number of times. How to do that?</p>
<pre>
List&lt;entry&gt; list = new LinkedList&lt;entry&gt;(callers.entrySet());
Collections.sort(list, new Comparator&lt;entry&gt;() {
    @Override
    public int compare(Entry o1, Entry o2) {
      return o2.getValue().compareTo(o1.getValue());
    }
});
</pre>
<p>And if it were Python:</p>
<pre>
lst = sorted(((n, fn) for fn, n in callers.iteritems()), reverse=True)
</pre>
<p>Yep, Java can be a pain.</p>
<p>Of course it&#8217;s not that simple, though. I&#8217;ve tested another simulator in Python and its code is very nice and readable and warm and fuzzy&#8230;</p>
<p>&#8230;but it&#8217;s 30 times slower than the Java one.</p>
]]></content:encoded>
			<wfw:commentRss>http://alicebob.cryptoland.net/yet-another-silly-python-vs-java-comparison/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

