Override hashCode() and equals().
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Apr 2011 18:32:36 +0000 (20:32 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 13 Apr 2011 18:32:36 +0000 (20:32 +0200)
src/main/java/net/pterodactylus/sone/data/Image.java

index d6e7114..0506172 100644 (file)
@@ -300,4 +300,27 @@ public class Image implements Fingerprintable {
                return fingerprint.toString();
        }
 
+       //
+       // OBJECT METHODS
+       //
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public int hashCode() {
+               return id.hashCode();
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public boolean equals(Object object) {
+               if (!(object instanceof Image)) {
+                       return false;
+               }
+               return ((Image) object).id.equals(id);
+       }
+
 }