Override Object.equals().
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 6 Apr 2013 12:42:51 +0000 (14:42 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 6 Apr 2013 12:42:51 +0000 (14:42 +0200)
src/main/java/net/pterodactylus/irc/Source.java

index 7574396..fc9d328 100644 (file)
@@ -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
        //