From a7aa348533ca20e1027c53dfdb8867016fc3379d Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 13 Apr 2011 20:32:36 +0200 Subject: [PATCH] Override hashCode() and equals(). --- .../java/net/pterodactylus/sone/data/Image.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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); + } + } -- 2.7.4