o Optimized performance by utilizing that project identity is based on g🅰️v which is just the map key

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@795948 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-07-20 18:32:52 +00:00
parent 9a6561c6f6
commit 043c8d6904
1 changed files with 5 additions and 2 deletions

View File

@ -20,9 +20,12 @@ public class ReactorArtifactRepository
{ {
private Map<String, MavenProject> reactorProjects; private Map<String, MavenProject> reactorProjects;
private final int hashCode;
public ReactorArtifactRepository( Map<String, MavenProject> reactorProjects ) public ReactorArtifactRepository( Map<String, MavenProject> reactorProjects )
{ {
this.reactorProjects = reactorProjects; this.reactorProjects = reactorProjects;
hashCode = ( reactorProjects != null ) ? reactorProjects.keySet().hashCode() : 0;
} }
@Override @Override
@ -182,7 +185,7 @@ public class ReactorArtifactRepository
@Override @Override
public int hashCode() public int hashCode()
{ {
return reactorProjects != null ? reactorProjects.hashCode() : 0; return hashCode;
} }
@Override @Override
@ -203,6 +206,6 @@ public class ReactorArtifactRepository
ReactorArtifactRepository other = (ReactorArtifactRepository) obj; ReactorArtifactRepository other = (ReactorArtifactRepository) obj;
return eq( reactorProjects, other.reactorProjects ); return eq( reactorProjects.keySet(), other.reactorProjects.keySet() );
} }
} }