From 5fbde8fee9152e47c41650a2aea5f1eba8ece5fa Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 6 Apr 2013 14:42:51 +0200 Subject: [PATCH] Override Object.equals(). --- src/main/java/net/pterodactylus/irc/Source.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/java/net/pterodactylus/irc/Source.java b/src/main/java/net/pterodactylus/irc/Source.java index 7574396..fc9d328 100644 --- a/src/main/java/net/pterodactylus/irc/Source.java +++ b/src/main/java/net/pterodactylus/irc/Source.java @@ -17,6 +17,7 @@ package net.pterodactylus.irc; +import com.google.common.base.Objects; import com.google.common.base.Optional; /** @@ -83,6 +84,28 @@ public class Source { } // + // OBJECT METHODS + // + + @Override + public boolean equals(Object object) { + if (!(object instanceof Source)) { + return false; + } + Source source = (Source) object; + if (!Objects.equal(nick(), source.nick())) { + return false; + } + if (!Objects.equal(username(), source.username())) { + return false; + } + if (!Objects.equal(server(), source.server())) { + return false; + } + return true; + } + + // // STATIC METHODS // -- 2.7.4