commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marcospera...@apache.org
Subject svn commit: r1360610 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java
Date Thu, 12 Jul 2012 10:06:45 GMT
Author: marcosperanza
Date: Thu Jul 12 10:06:45 2012
New Revision: 1360610

URL: http://svn.apache.org/viewvc?rev=1360610&view=rev
Log:
Replaced hashCode implementation with org.apache.commons.graph.utils.Objects#hash()

Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java?rev=1360610&r1=1360609&r2=1360610&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java
Thu Jul 12 10:06:45 2012
@@ -23,6 +23,7 @@ import static java.lang.String.format;
 import static java.util.Collections.unmodifiableCollection;
 import static java.util.Collections.unmodifiableSet;
 import static org.apache.commons.graph.utils.Objects.eq;
+import static org.apache.commons.graph.utils.Objects.hash;
 
 import java.util.HashMap;
 import java.util.HashSet;
@@ -143,16 +144,14 @@ public abstract class BaseGraph<V, E>
         return adjacencyList;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public int hashCode()
     {
         final int prime = 31;
-        int result = 1;
-        result = prime * result + ( ( adjacencyList == null ) ? 0 : adjacencyList.hashCode()
);
-        result = prime * result + ( ( allEdges == null ) ? 0 : allEdges.hashCode() );
-        result = prime * result + ( ( indexedEdges == null ) ? 0 : indexedEdges.hashCode()
);
-        result = prime * result + ( ( indexedVertices == null ) ? 0 : indexedVertices.hashCode()
);
-        return result;
+        return hash( 1, prime, adjacencyList, allEdges, indexedEdges, indexedVertices );
     }
 
     /**



Mime
View raw message