From a2f24c9ca57a37988917bb8679cdf29ff2008294 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 10 Apr 2013 08:24:39 +0200 Subject: [PATCH] Make channels work correctly in maps and sets. --- .../java/net/pterodactylus/xdcc/data/Channel.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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(); + } + } -- 2.7.4