implements hashCode/equals for Collections

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1165845 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-06 21:06:31 +00:00
parent 64bf00a031
commit 0f4fdab10d
1 changed files with 36 additions and 0 deletions

View File

@ -114,4 +114,40 @@ public class RepositoryGroup
{
this.repositories = repositories;
}
public boolean equals( Object other )
{
if ( this == other )
{
return true;
}
if ( !( other instanceof RepositoryGroup ) )
{
return false;
}
RepositoryGroup that = (RepositoryGroup) other;
boolean result = true;
result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
return result;
}
public int hashCode()
{
int result = 17;
result = 37 * result + ( id != null ? id.hashCode() : 0 );
return result;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append( "RepositoryGroup" );
sb.append( "{id='" ).append( id ).append( '\'' );
sb.append( ", repositories=" ).append( repositories );
sb.append( '}' );
return sb.toString();
}
}