Use all parameters for equality.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Oct 2010 10:35:43 +0000 (12:35 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Oct 2010 10:35:43 +0000 (12:35 +0200)
src/main/java/net/pterodactylus/sone/data/Reply.java

index cfc6d91..44aaf89 100644 (file)
@@ -152,7 +152,7 @@ public class Reply {
         */
        @Override
        public int hashCode() {
-               return post.hashCode() ^ id.hashCode();
+               return sone.hashCode() ^ id.hashCode() ^ post.hashCode() ^ (int) (time >> 32) ^ (int) (time & 0xffffffff);
        }
 
        /**
@@ -163,7 +163,8 @@ public class Reply {
                if (!(object instanceof Reply)) {
                        return false;
                }
-               return ((Reply) object).post.equals(post) && ((Reply) object).id.equals(id);
+               Reply reply = (Reply) object;
+               return reply.sone.equals(sone) && reply.id.equals(id) && reply.post.equals(post) && (reply.time == time) && reply.text.equals(text);
        }
 
 }