From: David ‘Bombe’ Roden Date: Wed, 10 Apr 2013 06:24:39 +0000 (+0200) Subject: Make channels work correctly in maps and sets. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a2f24c9ca57a37988917bb8679cdf29ff2008294;p=xudocci.git Make channels work correctly in maps and sets. --- diff --git a/src/main/java/net/pterodactylus/xdcc/data/Channel.java b/src/main/java/net/pterodactylus/xdcc/data/Channel.java index 59be331..93ebfa0 100644 --- a/src/main/java/net/pterodactylus/xdcc/data/Channel.java +++ b/src/main/java/net/pterodactylus/xdcc/data/Channel.java @@ -65,4 +65,28 @@ public class Channel { return name; } + // + // OBJECT METHODS + // + + @Override + public boolean equals(Object object) { + if (!(object instanceof Channel)) { + return false; + } + Channel channel = (Channel) object; + if (!network().equals(channel.network())) { + return false; + } + if (!name().equalsIgnoreCase(channel.name())) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return network().hashCode() ^ name().hashCode(); + } + }