You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by bl...@apache.org on 2003/07/10 16:31:03 UTC
cvs commit: avalon-sandbox/meta/spi/src/java/org/apache/avalon/meta/info Descriptor.java
bloritsch 2003/07/10 07:31:03
Modified: meta/spi/src/java/org/apache/avalon/meta/info
Descriptor.java
Log:
Any time the .equals() method is overridden, the .hashCode method must also be overridden. That way it will function properly in HashMaps or Hashtables.
Revision Changes Path
1.2 +10 -2 avalon-sandbox/meta/spi/src/java/org/apache/avalon/meta/info/Descriptor.java
Index: Descriptor.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/meta/spi/src/java/org/apache/avalon/meta/info/Descriptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Descriptor.java 10 Jul 2003 12:10:27 -0000 1.1
+++ Descriptor.java 10 Jul 2003 14:31:03 -0000 1.2
@@ -149,6 +149,14 @@
}
/**
+ * Return the hashcode for this object.
+ */
+ public int hashCode()
+ {
+ return m_attributes.hashCode();
+ }
+
+ /**
* Returns the property set.
*
* @return the dproperty set.
@@ -159,7 +167,7 @@
}
- private boolean compare( Descriptor primary, Descriptor secondary )
+ private static boolean compare( Descriptor primary, Descriptor secondary )
{
if( primary.getAttributeNames().length != secondary.getAttributeNames().length )
{
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org