avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-sandbox/meta/spi/src/java/org/apache/avalon/meta/info Descriptor.java
Date Thu, 10 Jul 2003 14:31:03 GMT
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


Mime
View raw message