From: David ‘Bombe’ Roden Date: Thu, 14 Oct 2010 10:32:38 +0000 (+0200) Subject: Use all available parameters for post equality. X-Git-Tag: 0.1-RC1~403 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=2d0067ede0cb2b85498abbc8cffe0ed5dce93242;hp=3057b4c74a69b4a2c58f0b75aff62d44747934d3;p=Sone.git Use all available parameters for post equality. --- 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); } }