<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: LinkedHashMap trick</title>
	<link>http://tech.puredanger.com/2007/09/23/linkedhashmap-trick/</link>
	<description>Alex Miller's technical blog</description>
	<pubDate>Sun, 12 Oct 2008 18:27:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: Steve</title>
		<link>http://tech.puredanger.com/2007/09/23/linkedhashmap-trick/#comment-26524</link>
		<pubDate>Mon, 11 Feb 2008 15:56:33 +0000</pubDate>
		<guid>http://tech.puredanger.com/2007/09/23/linkedhashmap-trick/#comment-26524</guid>
					<description>A suggested change.
return size() &amp;#62;= this.maxCapacity;
should be
return size() &amp;#62; this.maxCapacity;
because removeEldest is called after a new element is inserted. If you do &amp;#62;=, your map will maintain maxCapacity-1 as its size.</description>
		<content:encoded><![CDATA[<p>A suggested change.<br />
return size() &gt;= this.maxCapacity;<br />
should be<br />
return size() &gt; this.maxCapacity;<br />
because removeEldest is called after a new element is inserted. If you do &gt;=, your map will maintain maxCapacity-1 as its size.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Mario</title>
		<link>http://tech.puredanger.com/2007/09/23/linkedhashmap-trick/#comment-17165</link>
		<pubDate>Tue, 11 Dec 2007 15:42:23 +0000</pubDate>
		<guid>http://tech.puredanger.com/2007/09/23/linkedhashmap-trick/#comment-17165</guid>
					<description>It makes more sense to inherit rather than use composition (callback) since the method will require access to the internals of the class. Otherwise you would be bound to only using the methods publicly available in your callback method which may not be desirable. Its not a big deal to subclass since you're not really trying to inherit other behavior.</description>
		<content:encoded><![CDATA[<p>It makes more sense to inherit rather than use composition (callback) since the method will require access to the internals of the class. Otherwise you would be bound to only using the methods publicly available in your callback method which may not be desirable. Its not a big deal to subclass since you&#8217;re not really trying to inherit other behavior.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: José</title>
		<link>http://tech.puredanger.com/2007/09/23/linkedhashmap-trick/#comment-9273</link>
		<pubDate>Fri, 28 Sep 2007 20:08:37 +0000</pubDate>
		<guid>http://tech.puredanger.com/2007/09/23/linkedhashmap-trick/#comment-9273</guid>
					<description>Hi Alex,

commons-collections (since v3.0) also offers a LRU Map implementation: http://commons.apache.org/collections/apidocs/org/apache/commons/collections/map/LRUMap.html

Regards,
José</description>
		<content:encoded><![CDATA[<p>Hi Alex,</p>
<p>commons-collections (since v3.0) also offers a LRU Map implementation: <a href='http://commons.apache.org/collections/apidocs/org/apache/commons/collections/map/LRUMap.html' rel='nofollow'>http://commons.apache.org/collections/apidocs/org/apache/commons/collections/map/LRUMap.html</a></p>
<p>Regards,<br />
José
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Alex</title>
		<link>http://tech.puredanger.com/2007/09/23/linkedhashmap-trick/#comment-8966</link>
		<pubDate>Mon, 24 Sep 2007 15:34:03 +0000</pubDate>
		<guid>http://tech.puredanger.com/2007/09/23/linkedhashmap-trick/#comment-8966</guid>
					<description>@BlogReader: Yep, shoulda been final.

@Maris: Yes, PriorityQueue can definitely do LRU (or whatever you want).  But it's not a map or suitable for a cache, so I'm not sure it applies here.</description>
		<content:encoded><![CDATA[<p>@BlogReader: Yep, shoulda been final.</p>
<p>@Maris: Yes, PriorityQueue can definitely do LRU (or whatever you want).  But it&#8217;s not a map or suitable for a cache, so I&#8217;m not sure it applies here.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Maris</title>
		<link>http://tech.puredanger.com/2007/09/23/linkedhashmap-trick/#comment-8965</link>
		<pubDate>Mon, 24 Sep 2007 15:22:11 +0000</pubDate>
		<guid>http://tech.puredanger.com/2007/09/23/linkedhashmap-trick/#comment-8965</guid>
					<description>you can get LRU with PriorityQueue as well.</description>
		<content:encoded><![CDATA[<p>you can get LRU with PriorityQueue as well.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
