]> source.dussan.org Git - archiva.git/commitdiff
implements hashCode/equals for Collections
authorOlivier Lamy <olamy@apache.org>
Tue, 6 Sep 2011 21:06:31 +0000 (21:06 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 6 Sep 2011 21:06:31 +0000 (21:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1165845 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroup.java

index 0173d396ba2f32b2bc525fe82831d1234c9a90ee..5e44596edd4b63f35f3b7f5a37f8513efeb49018 100644 (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();
+    }
 }