From: David ‘Bombe’ Roden Date: Wed, 13 Apr 2011 18:32:36 +0000 (+0200) Subject: Override hashCode() and equals(). X-Git-Tag: 0.7^2~2^2~80 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a7aa348533ca20e1027c53dfdb8867016fc3379d;p=Sone.git Override hashCode() and equals(). --- diff --git a/src/main/java/net/pterodactylus/sone/data/Image.java b/src/main/java/net/pterodactylus/sone/data/Image.java index d6e7114..0506172 100644 --- a/src/main/java/net/pterodactylus/sone/data/Image.java +++ b/src/main/java/net/pterodactylus/sone/data/Image.java @@ -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); + } + }