commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r959172 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
Date Wed, 30 Jun 2010 03:19:59 GMT
Author: bayard
Date: Wed Jun 30 03:19:56 2010
New Revision: 959172

URL: http://svn.apache.org/viewvc?rev=959172&view=rev
Log:
Improving javadoc for HashCodeBuilder.append(boolean) and the general class javadoc per LANG-628

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java?rev=959172&r1=959171&r2=959172&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
Wed Jun 30 03:19:56 2010
@@ -38,11 +38,18 @@ import org.apache.commons.lang3.ArrayUti
  * </p>
  * 
  * <p>
+ * The following is the approach taken. When appending a data field, the current total is
multiplied by the 
+ * multiplier then a relevant value 
+ * for that data type is added. For example, if the current hashCode is 17, and the multiplier
is 37, then 
+ * appending the integer 45 will create a hashcode of 674, namely 17 * 37 + 45. 
+ * </p>
+ * 
+ * <p>
  * All relevant fields from the object should be included in the <code>hashCode</code>
method. Derived fields may be
  * excluded. In general, any field used in the <code>equals</code> method must
be used in the <code>hashCode</code>
  * method.
  * </p>
- * 
+ *
  * <p>
  * To use this class write code as follows:
  * </p>
@@ -608,8 +615,10 @@ public class HashCodeBuilder implements 
      * Append a <code>hashCode</code> for a <code>boolean</code>.
      * </p>
      * <p>
-     * This adds <code>iConstant * 1</code> to the <code>hashCode</code>
and not a <code>1231</code> or
-     * <code>1237</code> as done in java.lang.Boolean. This is in accordance
with the <quote>Effective Java</quote>
+     * This adds <code>1</code> when true, and <code>0</code> when
false to the <code>hashCode</code> 
+     * and not a <code>1231</code> or
+     * <code>1237</code> as done in java.lang.Boolean (see java.lang.Boolean
javadoc). This is in 
+     * accordance with the <quote>Effective Java</quote>
      * design.
      * </p>
      * 



Mime
View raw message