commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: svn commit: r1360580 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java
Date Thu, 12 Jul 2012 10:00:31 GMT
Hi Marco,

> +    @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;
> +    }

good! IMHO this can be fixed using the
org.apache.commons.graph.utils.Objects#hash() shortcut, i.e.

> import static org.apache.commons.graph.utils.Objects.hash;
> ...
> +    @Override
> +    public int hashCode()
> +    {
> +        final int prime = 31;
> +        return hash( 1, prime, adjacencyList, allEdges, indexedEdges, indexedVertices
);
> +    }

best and thanks!
-Simo

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message