From: David ‘Bombe’ Roden Date: Sat, 6 Apr 2013 12:42:51 +0000 (+0200) Subject: Override Object.equals(). X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;ds=inline;h=5fbde8fee9152e47c41650a2aea5f1eba8ece5fa;p=xudocci.git Override Object.equals(). --- 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 //