scolebourne    2003/12/28 10:08:54

  Modified:    collections/src/java/org/apache/commons/collections Bag.java
  Log:
  Document preferred equals behaviour
  
  Revision  Changes    Path
  1.12      +26 -2     
jakarta-commons/collections/src/java/org/apache/commons/collections/Bag.java
  
  Index: Bag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/Bag.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Bag.java  31 Aug 2003 17:26:44 -0000      1.11
  +++ Bag.java  28 Dec 2003 18:08:54 -0000      1.12
  @@ -239,4 +239,28 @@
        */
       Iterator iterator();
   
  +    // The following is not part of the formal Bag interface, however where possible
  +    // Bag implementations should follow these comments.
  +//    /**
  +//     * Compares this Bag to another.
  +//     * This Bag equals another Bag if it contains the same number of occurances of
  +//     * the same elements.
  +//     * This equals definition is compatable with the Set interface.
  +//     * 
  +//     * @param obj  the Bag to compare to
  +//     * @return true if equal
  +//     */
  +//    boolean equals(Object obj);
  +//
  +//    /**
  +//     * Gets a hash code for the Bag compatable with the definition of equals.
  +//     * The hash code is defined as the sum total of a hash code for each element.
  +//     * The per element hash code is defined as
  +//     * <code>(e==null ? 0 : e.hashCode()) ^ noOccurances)</code>.
  +//     * This hash code definition is compatable with the Set interface.
  +//     * 
  +//     * @return the hash code of the Bag
  +//     */
  +//    int hashCode();
  +    
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to