aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2005-12-07 17:10:28 +0000
committeraclement <aclement>2005-12-07 17:10:28 +0000
commit3425506574d5bcd84e35c57434a7b9e2225b40f8 (patch)
tree994a331fff4090f2ccc259a50c8c8726b415b542
parentd59d098f734532ed1461e56a2d8321dfd25a6585 (diff)
downloadaspectj-3425506574d5bcd84e35c57434a7b9e2225b40f8.tar.gz
aspectj-3425506574d5bcd84e35c57434a7b9e2225b40f8.zip
addressing 118877
-rw-r--r--docs/progGuideDB/examples.xml16
1 files changed, 10 insertions, 6 deletions
diff --git a/docs/progGuideDB/examples.xml b/docs/progGuideDB/examples.xml
index 12c6d1ccc..2847f13d2 100644
--- a/docs/progGuideDB/examples.xml
+++ b/docs/progGuideDB/examples.xml
@@ -541,12 +541,16 @@ public aspect ComparablePoint {
</para>
<para>
- The method <literal>Object.hashCode</literal> returns an unique
- integer, suitable for use as a hash table key. Different
- implementations are allowed return different integers, but must
- return distinct integers for distinct objects, and the same integer
- for objects that test equal. But since the default implementation
- of <literal>Object.equal</literal> returns <literal>true</literal>
+ The method <literal>Object.hashCode</literal> returns an
+ integer, suitable for use as a hash table key. It is not required
+ that two objects which are not equal (according to the
+ <literal>equals</literal> method) return different integer
+ results from <literal>hashCode</literal> but it can
+ improve performance when the integer is used as a key into a
+ data structure. However, any two objects which are equal
+ must return the same integer value from a call to
+ <literal>hashCode</literal>. Since the default implementation
+ of <literal>Object.equals</literal> returns <literal>true</literal>
only when two objects are identical, we need to redefine both
<function>equals</function> and <function>hashCode</function> to work
correctly with objects of type <classname>Point</classname>. For