<?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: Back to Basics: hashCode() &amp; equals()</title>
	<atom:link href="http://blogs.sourceallies.com/2011/12/back-to-basics-hashcode-equals/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.sourceallies.com/2011/12/back-to-basics-hashcode-equals/</link>
	<description>Technical and process thinking from Source Allies employees</description>
	<lastBuildDate>Fri, 17 May 2013 17:02:09 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Adriana</title>
		<link>http://blogs.sourceallies.com/2011/12/back-to-basics-hashcode-equals/comment-page-1/#comment-4422</link>
		<dc:creator>Adriana</dc:creator>
		<pubDate>Sat, 25 Feb 2012 03:19:14 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=2598#comment-4422</guid>
		<description>thanks for share!</description>
		<content:encoded><![CDATA[<p>thanks for share!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hugh</title>
		<link>http://blogs.sourceallies.com/2011/12/back-to-basics-hashcode-equals/comment-page-1/#comment-4288</link>
		<dc:creator>Hugh</dc:creator>
		<pubDate>Mon, 20 Feb 2012 11:28:23 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=2598#comment-4288</guid>
		<description>There are good ideas in this article .. This site is one of my favorite</description>
		<content:encoded><![CDATA[<p>There are good ideas in this article .. This site is one of my favorite</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gilbert Pantoliano</title>
		<link>http://blogs.sourceallies.com/2011/12/back-to-basics-hashcode-equals/comment-page-1/#comment-4253</link>
		<dc:creator>Gilbert Pantoliano</dc:creator>
		<pubDate>Sun, 19 Feb 2012 00:01:52 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=2598#comment-4253</guid>
		<description>Good description.</description>
		<content:encoded><![CDATA[<p>Good description.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Kessler</title>
		<link>http://blogs.sourceallies.com/2011/12/back-to-basics-hashcode-equals/comment-page-1/#comment-3766</link>
		<dc:creator>David Kessler</dc:creator>
		<pubDate>Mon, 06 Feb 2012 16:35:28 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=2598#comment-3766</guid>
		<description>Great catch.  The default Eclipse generate hashCode() &amp; equals() defaults to class comparison with an option to use instanceof comparison instead.  I&#039;ve posted a feature request back to the Guava Plugin project.  http://sourceforge.net/tracker/?func=detail&amp;aid=3485014&amp;group_id=388911&amp;atid=1615624.  It is worth noting that I found the following options in the Guava Preferences within Eclipse.
&lt;ul&gt;
	&lt;li&gt;-  Use super class Methods(toString(), equals() and hashCode())&lt;/li&gt;
	&lt;li&gt;-  Don&#039;t use super class Methods (toString(), equals(), and hashCode())&lt;/li&gt;
	&lt;li&gt;-  Use super class Methods (Only if superclass is not &quot;java.lang.Object&quot;)&lt;/li&gt;
&lt;/ul&gt;

The third option is the default setting.  I think this is very helpful.  Nevertheless, these options do not eliminate the need for class comparison.  Without a class comparison option the generated code can still violate symmetry.  This plugin should err on the side of caution by using class comparison by default.  &#039;instanceof&#039; comparison should be an option rather than the default.  Thank you for your excellent comments.</description>
		<content:encoded><![CDATA[<p>Great catch.  The default Eclipse generate hashCode() &amp; equals() defaults to class comparison with an option to use instanceof comparison instead.  I&#8217;ve posted a feature request back to the Guava Plugin project.  <a href="http://sourceforge.net/tracker/?func=detail&amp;aid=3485014&amp;group_id=388911&amp;atid=1615624" rel="nofollow">http://sourceforge.net/tracker/?func=detail&amp;aid=3485014&amp;group_id=388911&amp;atid=1615624</a>.  It is worth noting that I found the following options in the Guava Preferences within Eclipse.</p>
<ul>
<li>-  Use super class Methods(toString(), equals() and hashCode())</li>
<li>-  Don&#8217;t use super class Methods (toString(), equals(), and hashCode())</li>
<li>-  Use super class Methods (Only if superclass is not &#8220;java.lang.Object&#8221;)</li>
</ul>
<p>The third option is the default setting.  I think this is very helpful.  Nevertheless, these options do not eliminate the need for class comparison.  Without a class comparison option the generated code can still violate symmetry.  This plugin should err on the side of caution by using class comparison by default.  &#8216;instanceof&#8217; comparison should be an option rather than the default.  Thank you for your excellent comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Akrem Saed</title>
		<link>http://blogs.sourceallies.com/2011/12/back-to-basics-hashcode-equals/comment-page-1/#comment-3765</link>
		<dc:creator>Akrem Saed</dc:creator>
		<pubDate>Mon, 06 Feb 2012 16:15:36 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=2598#comment-3765</guid>
		<description>Very powerful post, I didn&#039;t know what to think about Guava before but now I&#039;m impressed. Nice job, David. 

And here is one more point about equals implementation. I see you used &quot;instanceof&quot; test which has the implication that you want a subclass object be considered the same as the superclass object if it has the same field values used in the equals test. This can lead to equality unsymmetry where if a subclass overwrites the equals method using &quot;if (object instanceof PersonWithGuavaSubclass)&quot; you will run into situation where subObject.equals(superObject) will always be false but superObject.equals(subObject) might return with true. 

I find it sometimes helpful to NOT consider them the same by testing equality on the actual class names of the subclass and superclass. 

This approach, will help insure symmetry where if a subclass overwrites the equals method to use some new additional fields in the test, you can ensure that subObject.equals(superObject) is the same as superObject.equals(subObject).</description>
		<content:encoded><![CDATA[<p>Very powerful post, I didn&#8217;t know what to think about Guava before but now I&#8217;m impressed. Nice job, David. </p>
<p>And here is one more point about equals implementation. I see you used &#8220;instanceof&#8221; test which has the implication that you want a subclass object be considered the same as the superclass object if it has the same field values used in the equals test. This can lead to equality unsymmetry where if a subclass overwrites the equals method using &#8220;if (object instanceof PersonWithGuavaSubclass)&#8221; you will run into situation where subObject.equals(superObject) will always be false but superObject.equals(subObject) might return with true. </p>
<p>I find it sometimes helpful to NOT consider them the same by testing equality on the actual class names of the subclass and superclass. </p>
<p>This approach, will help insure symmetry where if a subclass overwrites the equals method to use some new additional fields in the test, you can ensure that subObject.equals(superObject) is the same as superObject.equals(subObject).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
