From: Olivier Lamy Date: Tue, 6 Sep 2011 21:06:31 +0000 (+0000) Subject: implements hashCode/equals for Collections X-Git-Tag: archiva-1.4-M1~374 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0f4fdab10d3390664ae99f309d4a5251a15a918d;p=archiva.git implements hashCode/equals for Collections git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1165845 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroup.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroup.java index 0173d396b..5e44596ed 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroup.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroup.java @@ -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(); + } }