From 2d0067ede0cb2b85498abbc8cffe0ed5dce93242 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 14 Oct 2010 12:32:38 +0200 Subject: [PATCH] Use all available parameters for post equality. --- src/main/java/net/pterodactylus/sone/data/Post.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/data/Post.java b/src/main/java/net/pterodactylus/sone/data/Post.java index f7fbcd3..58c50e1 100644 --- a/src/main/java/net/pterodactylus/sone/data/Post.java +++ b/src/main/java/net/pterodactylus/sone/data/Post.java @@ -173,7 +173,7 @@ public class Post { */ @Override public int hashCode() { - return id.hashCode(); + return id.hashCode() ^ sone.hashCode() ^ (int) (time >>> 32) ^ (int) (time & 0xffffffff) ^ text.hashCode(); } /** @@ -184,7 +184,8 @@ public class Post { if (!(object instanceof Post)) { return false; } - return ((Post) object).id.equals(id); + Post post = (Post) object; + return post.id.equals(id) && post.sone.equals(sone) && (post.time == time) && post.text.equals(text); } } -- 2.7.4